I'm new on google spreadsheets, and I'm having this little problem:
I need to Sum values from column K (a project), for an specified person in cell B3, where the project belongs to the category RF or RM in column C, I've tried this but returns the sum of K like not conditions where applied...
=arrayformula(if(AND('SheetX'!I$3:I=B3;OR('SheetX'!C$3:C="RF";'SheetX'!C$3:C="RM"));sum('SheetX'!K$3:K);0))
Also
=arrayformula(Sum(if(AND('SheetX'!I$3:I=B3;OR('SheetX'!C$3:C="RF";'SheetX'!C$3:C="RM"));'SheetX'!K$3:K;0)))
Thanks to anyone who can help me with this simple issue.
Already fixed. According to this link "The OR function does not work in array expression (nor does the AND function; but the NOT function does work). The workaround is to use ADD instead of OR and MULTIPLY instead of AND instead; for practical reasons use the + operator associated with ADD and the * operator associated with MULTIPLY."
What I did was this:
=Sum(filter('SheetX'!K$3:K;'SheetX'!I$3:I=B3;('SheetX'!C$3:C="RF")+('SheetX'!C$3:C="RM")))
Thanks to this video that clear it up.
Related
I'm trying to take the names from column A compare them to the names in column B and then have the similar names get listed in column C.
The problem is these names are automatically updated and out of order, and I need the function in column C to update with them. Also, the names will not be in order, this is why I can't use A=B function. The picture shown is an example of what the solution would look like or something similar. After completing this, I would like to continue using the same function to break down the name data even more. Watched a lot of videos on this, can't find anything specific enough to work.
Side note, I have found a way to do this using different pages within the sheets but not in the same sheet side by side. ex. of what solution
I have tried watching lots of YouTube videos, but nothing goes into detail enough and seem to only explain when similar values are next to each other in column A and B.
This is what I use for 2 different sheets but can't find / understand why when changing values in function to single sheet it wont work:
=filter(Sheet1!A2:B,ISNUMBER(match(Sheet1!A2:A,Raid1!A2:A,0)))
Also, another side note: Can't use True or False. And for uneven number of names in the list ex. Column A has 10 and B has 7 it sorts A for names in B and post similar in C.
Try below formula-
=FILTER(C3:C,INDEX(COUNTIFS(D3:D,C3:C))>0)
You can use VLOOKUP to check common values between columns and store them in another column.
=IFERROR(VLOOKUP(A:A,B:B,1,false),"")
Although this will create gaps in the output column. you can get rid of it by by simply using a filter or so.
all you need is:
=FILTER(C3:C; COUNTIFS(D3:D; C3:C))
I have a list of identifiers and a value for each identifier which is filled automatically.
I want to filter the list so I will only get unique identifiers and their respective value.
e.g. "Dana" can appears 3 times but in the filtered table I only want to see the name (and the value) once.
Ideally I'd like to use something like
=filter(a:b,unique(a:a) which obviously doesn't work.
As mentioned, the list updates automatically so a formula that needs to be dragged won't do the trick.
Note: It can be solved by extracting uniques from col A
=unique(A:A)
and then an Arrayformula + vLookup
=arrayformula(if(I1:I>0,vlookup(I1:I,A:B,2,0),""))
but I'm curious to see if it can be solved using Filter for more elegance.
Here's an example (including the solution I mentioned):
https://docs.google.com/spreadsheets/d/1heKdV3U6mdGYkHCIWkeUyqo6AfhgV7ItSmolibH7ecU/edit?usp=sharing
Please use the following
=UNIQUE(A:B)
UPDATE
Following OP's comment/request:
Nice fix! Out of curiosity - is it possible to still use it with the filter function (for example, if I wanted to filter by Col B or add other restrictions) ?
Sure. Try these ones out
=UNIQUE(FILTER(A:B,B:B=333))
OR
=FILTER(UNIQUE(A:B),UNIQUE(B:B)=333)
Reference:
UNIQUE
In column B are listed IDs of Google Sheets. In column C are listed cells, from which I want to import data.
Screenshot of the table
In column D is shown the result of using IMPORTRANGE() by simply dragging it. e.g. for D1 it looks like:
=IMPORTRANGE(B1;C1)
for D2:
=IMPORTRANGE(B2;C2)
and so on.
In column E I want to display the same result but using ARRAYFORMULA that looks like:
=ARRAYFORMULA(IMPORTRANGE(B2:B4,C2:C4))
but the function displays only the data from the first spreadsheet.
People complain about this permissions issue a lot, but it's not hard to solve. What I do is have a sheet which I name "Splash sheet" into which I paste the URLs of the documents I wish to link. To its right is a column headed "permit to connect" which contains IMPORTRANGE formulas importing a single cell from each sheet -- usually a cell containing a confirmation code, number or document name -- on a sheet also named "Splash Sheet." For example,
=IF(B3="enter URL",,CONCATENATE(IMPORTRANGE(B3,"Splash sheet!A1")," ",IMPORTRANGE(B3,"Splash sheet!B1")))
So, when you first connect a spreadsheet via its URL, you get those messages telling you you need to connect, you click the Permit Access, the confirmation code/number/document name appears in the second column, and voilá, your sheets are connected forevermore! Now all your other IMPORTRANGEs referencing that URL will work, and you can use IMPORTRANGE formulas that reference the URL-containing cells on the "splash sheet."
As for the OP's original question, I came here seeking an answer to the same problem, and after more research have realized that we are attempting the impossible here. No way to do this an ARRAYFORMULA. No way around writing formulas that reference every single cell a document's URL may go into.
Problem is you can't make arrays of arrays in spreadsheets; that would involve multiple dimensions, and the medium is inherently two-dimensional. This is what people use databases for.
ARRAYFORMULA doesn't work when importing data (I think it relates to permissions). You could use something like this, =IFERROR(IMPORTRANGE(B5:B7;C5:C7)) and pre-fill the column first, but still there would be the permissions issue. Each new imported sheet needs it's permissions granted by a user.
TLDR: If I understand your intention correctly when you say you would like to see
=ARRAYFORMULA(IMPORTRANGE(B2:B4,C2:C4)), I believe you can make that
happen using the following.
=ARRAYFORMULA(IMPORTRANGE(
INDIRECT(ADDRESS(ROW(B2:B4), COLUMN(B2:B4)),
INDIRECT(ADDRESS(ROW(C2:C4), COLUMN(C2:C4))
)
Breakdown
Use IMPORTRANGE with INDIRECT to create ranges inside ARRAYFORMULA
Call INDIRECT with the ADDRESS function
Call ADDRESS with the ROW and COLUMN functions since they take ranges via ARRAYFORMULA
using IMPORTRANGE with INDIRECT
IMPORTRANGE's two parameters are the spreadsheet url stored in B2:B4 for this example and the range (e.g. sheet!A1:B2) stored in C2:C4.
Since IMPORTRANGE doesn't take a range reference directly as you mentioned, you'll need to build it for each row with ARRAYFORMULA using the INDIRECT function.
INDIRECT can be used to compose a cell reference using A1 notation, for instance
=IMPORTRANGE(INDIRECT("B" & 2), INDIRECT("C" & 2))
will produce the same result as
=IMPORTRANGE(B2, C2)
Since this produces the same result, we now just have to find a way to make INDIRECT work with ARRAYFORMULA
Use ADDRESS to build the parameters for INDIRECT
Next you want to use ADDRESS to build the A1 reference for INDIRECT. For the current purposes, ADDRESS takes a numerical value for row and column as parameters
=INDIRECT(ADDRESS(2,2))
will produce the same result as
=INDIRECT("B" & 2)
Since these two are interchangeable, now we just need to find a way to get the numerical row and column values out of ARRAYFORMULA.
Call ADDRESS using the ROW and COLUMN functions
From there, you can get the row and column indexes from standard A1 notation using the ROW and COLUMN functions. While this may seem like we're pointlessly going in circles, the difference now is that ROW and COLUMN perform as expected with the ranges provided by ARRAYFORMULA. So given that ADDRESS will return $B$2 using using either method below
=ADDRESS(2,2)
or
=ADDRESS(ROW(B2),COLUMN(B2))
we now know that
=ARRAYFORMULA(ADDRESS(ROW(B2:B4),COLUMN(B2:B4)))
will produce the following array of addresses
{ $B$2; $B$3; $B$4 }
Final Assembly
So when we put this all together, we get
=ARRAYFORMULA(IMPORTRANGE(
INDIRECT(ADDRESS(ROW(B2:B4), COLUMN(B2:B4)),
INDIRECT(ADDRESS(ROW(C2:C4), COLUMN(C2:C4))
)
where INDIRECT(ADDRESS(ROW(B2:B4), COLUMN(B2:B4)) is more or less interchangeable with what you might expect from B2:B4 inside ARRAYFORMULA and represents the url parameter
and INDIRECT(ADDRESS(ROW(C2:C4), COLUMN(C2:C4)) is roughly interchangeable with what you might expect from C2:C4 inside ARRAYFORMULA and represents the range parameter.
Suggestions on organization
I recommend using the indentation (Alt +Enter to create a new line ) above along with your indentation of choice to keep it easier to read. In the end it's just a bit more syntactic sugar and if spaces are used well it shouldn't be much harder to understand and make changes to 6 months later.
RE: Permissions - as mentioned by Atiq Zabinski, just placing a simple
IMPORTRANGE("http:/xxxx", "A1") somewhere on the sheet will provide a
means to know if the sheet is connected or not and the error message
should give you a context menu for connecting the sheet. You'll might
want to stay away from error handling in these scenarios as it will
slow down the process of connecting the sheets.
I wrote a =QUERY formula in Google spreadsheet. However I would like to copy not only the values of the cells but also the embedded links from the range of cells I am performing the query on. This is what I wrote:
=QUERY('Tab'!6:1963,"select C where (E='Major' and D >= now())")
There must be a way to tell the query to bring the URL as well along the content of the cells.
The query function only supports certain data types:
Supported data types are string, number, boolean, date, datetime and timeofday.
It doesn't handle other things one might embed into a spreadsheet, such as images or hyperlinks. (Hyperlinks are coerced to strings.) After all, the query language is not something Sheets-specific, it has its own data models that interact with Sheets only to an extent.
A solution is to use filter instead of query, if possible. It can do many of the things that query does. For example,
=QUERY(Tab!6:1963,"select C where (E='Major' and D >= now())")
can be replaced by
=filter(Tab!C6:C1963, (Tab!E6:E1963="Major") * (Tab!E6:E1963 >= now()))
which will return the links as expected. (And even images inserted with =image() if you got them.) The multiplication operator is logical and in the filter formula.
I know this is three years later, but I ran into this issue and my query would have converted to a complicated nest of FILTER and SORT functions. So I ended up doing something like this: ARRAYFORMULA(VLOOKUP(QUERY('Tab'!6:1963,"select C where (E='Major' and D >= now())"),C:C,1,FALSE))
Which worked.
Often this question comes into play with IMPORTRANGE. And Google's official answer does not really help (i.e. QUERY only works with strings, etc.). It is possible to give the filter range as an imported range, too, then it works:
=FILTER(IMPORTRANGE("XXX","Data!A1:A),
IMPORTRANGE("XXX","Data!B1:B")>0)
where column A is the data you want to import and column B is the filter
I have a google docs spreadsheet with two columns: A and B.
Values of B are just values from A in a different format, and I have a formula in the B column that does the conversion.
Sometimes I do not have the values in A format but I have them in B format. I would like to automatically get the values in A format in the A column by adding the formula that does the reverse conversion in the A column. This, of course, generates a circular reference. Is there a way to get around it?
On the top menu of a google spreadsheet do the following:
File > Spreadsheet settings
Choose the "Calculation" tab, and change "Iterative calculation" to ON.
Enjoy :D.
PD: I know that this post is too old, but just some days ago I needed a solution to this, and I couldn´t find any.
From this week, Google Sheets has announced support for exactly this feature. You can now limit the number of iterations for circular references in the spreadsheets settings :-)
In excel you can set it to allow circular dependencies and limit the number of iterations they run (usually 1 is the desired result).
I've looked and nothing like that exists in sheets.
I know that this post is pretty old, but I saw it while looking to see the applications of a thing.
In sheets, you can use importrange to reference the same sheet and call the desired range. For instance, you can put a formula in B1 that is =A1+1 and in A1 use the formula =importrange(<THIS SHEET ID>,"B1")+1.
You may need to initially put the formula in A2 and then move it up to A1, but it should work.
Doing something like this essentially makes a second counter, which is neat I guess?
Solved with a script that implements the following algorithm
for each row{
if (A != "" && B == "")
B = conversionFromA(A);
if (A == "" && B != "")
A = conversionFrom(B);}
of course it has it's downsides, (you have to call the script each time you enter new data), but it's the best solution I found
I would add two more columns: data source and data format. Then, the formula in column A would take a value from data source either as is (if the format matches) or converted (if format doesn't match). Same for column B.
Instead of referencing your co-dependent formula cells, use other cells to hold your actual (non-formulaic) data and use the formula cells to show your results.