Trying to index match information from 1 google sheet to another - google-sheets

I have the following 2 google sheets
TEST 1
https://docs.google.com/spreadsheets/d/1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg/edit?usp=sharing
TEST 2
https://docs.google.com/spreadsheets/d/15PAI8nnTzp1wQuvvkHxZ81kkeRrqHrvUH1vXiF9tya0/edit?usp=sharing
In Test 2 in cells B36,B37 and C36,C37 I am trying to grab information from TEST 1 to TEST 2
I have checked and checked and triple checked but I am not sure why it is not grabbing the information over.
Previously I had used "-" and "( )" in the table names so I decided to remove all of those and use only letters but it is still not working.
I also noticed that it was grabbing from the correct column (in my original google sheet), column D but it was grabbing the wrong information.
But I checked the name I was using to match "Room BS Harvest" and made sure it matched in both google sheets but still was not able to get it to work.
I have turned on show formula so you can see that I have formulas in Test 2 B36,B37,C36,C37
If you have any idea why it is not working please do let me know. I can't figure out why it is not getting the data over.

I myself would not approach things the way you are doing in this sheet. (I always recommend using a separate sheet within your destination spreadsheet where IMPORTRANGE brings in all of the data from the source location, and then using that single sheet in the destination spreadsheet as the reference for all other formulas, such as the ones you're trying to use.)
In addition, your sheets are inaccessible (i.e., "Comment only"). So neither I nor anyone else would be able to setup an alternative method for you to consider.
That said, and working with what you do have, here is how you might adjust the B36 formula...
Here is the formula you originally wrote (and which is not working):
=INDEX(importrange("https://docs.google.com/spreadsheets/d/1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg/edit#gid=0",$J$1&"!A4:H26"),MATCH($A36,index(importrange("https://docs.google.com/spreadsheets/d/1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg/edit#gid=0",$J$1&"!A4:A26"))),match($J$2,index(importrange("https://docs.google.com/spreadsheets/d/1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg/edit#gid=0",$J$1&"!A4:H4"))))
Here is my edit to that formula structure (which should work):
=INDEX(IMPORTRANGE("1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg",$J$1&"!A4:H26"),MATCH($A36,IMPORTRANGE("1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg",$J$1&"!A4:A26"),0),MATCH($J$2,index(IMPORTRANGE("1mAssNMTGXcMcuYhjDWq6lNfWOdgUfI6FbGSWushGAMg",$J$1&"!A4:H4")),0))
Notice that you only need the spreadsheets ID number for IMPORTRANGE, not the entire URL. This just makes reading such formulas easier.
You also had mismatched sets of parentheses. This was your biggest issue.
And I recommend using the third parameter of MATCH to indicate what kind of match you're looking for. (Here, I assigned 0, which means "exact match only.")
Hopefully, you can use that as a model for editing your other formulas.

Related

How do I return missing data when comparing two columns?

I've read a few similar questions, and I can't seem to find exactly what I'm trying to do.
I have a roster of employees in sheet "Roster" with their names in Column A. In sheet "Hours" I have a list of assigned jobs for tomorrow, with the assigned employee's name also in Column A. I'm trying to add a column of employees from the roster that are NOT in the list of employees on jobs.
The closest I've gotten is with this, on the Hours sheet:
=ARRAYFORMULA(VLOOKUP('Roster'!A2:A, A2:A,1,0))
which gives me a list of the entire roster, with the missing ones returning an #N/A error that tells me the missing name when I mouse over it and read the error code. Is there a way to just get a list of the errors? Would I be better off attacking this from a completely different angle?
EDIT: Sanitized example pictures. If what I was trying to do worked, it would return Bob and Jim in this example.
Assuming you're trying to return this list in the "Hours" sheet, you can build off what you had. Try this:
=ARRAYFORMULA(FILTER(A2:A,ISERROR(VLOOKUP('Roster'!A2:A, A2:A,1,0))))
Keep in mind that this formula was written sight-unseen. If it doesn't work as expected, consider sharing a link to a copy of your sheet (or to a sample sheet set up the same way and with enough sanitized but realistic data to illustrate the problem, along with the manually entered result you want in the range where you want it).
I ended up going a completely different route. I made a third "Under the Hood" sheet, pulled the two columns into it with queries, ran a match formula down the list and returned "" on errors, then ran a query on Hours to get the names where it had null for the match list.

Google Sheets DGET() does not find values

I have a fairly simple table, which looks like the following:
I want to get a specific value from that table. For that I am using two different formulas:
=iferror(DGET(Bazaar!$A:$K;"Top Sell-Offer";{"Item";"ENCHANTED_COAL"});"?") ==> returns "?"; Should get some numbers
=iferror(DGET(Bazaar!$A:$K;"Top Sell-Offer";{"Item";"ENCHANTED_OBSIDIAN"});"?") ==> returns "2747" as expected
I also tried =index(filter(Bazaar!$B:$K;Bazaar!$A:$A="ENCHANTED_COAL");;1)
which does return what I expected, but I can't specify the column I want by header.
Note that both strings for conditions and column headers are copy-pasted and thus character-perfect (As you can also see in the results.)
Also note that this does not happen with the truncated table provided, please refer to this sheet.
Why do I get such inconsistent results and what can I do about that?
Thanks in advance! Stay healthy!
I made a copy of your sheet and messed around with it. Finally, I decided to remove the IFERROR part and I got the error of "More than one match found in DGET evaluation.". The error was the key.
The formula is seeing "ENCHANTED_COAL_BLOCK" as another match for "ENCHANTED_COAL". Once I removed "COAL" from coal block, the formula worked as it should.
In order to get it to stop seeing double (to find an exact match), simply add an equal sign in front of the word you are looking for:
=IFERROR(DGET(Bazaar!$A:$K,"Top Sell-Offer",{"Item";"=ENCHANTED_COAL"}),"?")
=IFERROR(DGET(Bazaar!$A:$K,C$3,{$A$3;"="&$A5}),"?")
I recommend adding the equal sign in front of all words you search for just for consistency purposes.
Reference: https://infoinspired.com/google-docs/spreadsheet/exact-match-in-database-functions-in-google-sheets/

ARRAYFORMULA with IMPORTRANGE

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.

"Formula parse error" when querying different document

I am attempting to have a cell in Sheet B display data from a cell in External / Remote Sheet A, but it results in "Formula parse error." (ETA detail to aid searches: displaying data in one Google Spreadsheet from a different Google Sheet.)
My query:
=Query(SheetA,sheet1!A:I,"select I WHERE A=3")
I've also tried it this way:
=Query(SheetA,sheet1!$A:$I,"select I WHERE A=3",-1)
This answer courtesy of #AdamL (thank you, sir!). This was his answer that I found does work very well. When QUERY isn't directly referencing a range in the same spreadsheet, use Colx notation rather than column letters:
=QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1=3")
If referencing dynamically, use something like:
=QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1="&D19)
It is also important to note that you must first connect the sheets to each other. Until this is done, you will get column errors, etc. This is done by selecting a cell of the sheet that will display the data, and putting in an IMPORTRANGE on it, which opens a dialog for connecting them. More info: https://support.google.com/docs/answer/3093340?hl=en
I also realized (duh) that I was being stupid to have two separate files for each. I only need two sheets within the same document; 1 to serve as the database and the other to display the formatted data. I am using this for a pedigree application.
I had a Formula Parse Error problem. My mistake was that I had two brackets on my formula. I deleted one set, and it was fixed. I am not sure why, but it worked for me.
EXAMPLE:
=SUM((AB450,AB432,AB422,AB415,AB405)) - THIS GAVE ME A FORMULA PARSE ERROR.
=SUM(AB450,AB432,AB422,AB415,AB405) - THIS IS THE ONE THAT WORKED

SUMIF with FIND as criteria

I'm trying to summarize data from several Google spreadsheet' sheets in a single one but I have some issues with SUMIF and FIND.
To Sum data from another sheet I have to use this (at least that's the only solution I've found)
=SUM(INDIRECT(""&A6&""&"!E2:E"))
Where I have the name of my sheet on A6.This makes everything easy because I have a column (A) with all the names of the sheets. I haven't found something like Sheets[1] in Google Docs.
My next step was to Sum Times from a specific column but remove a specific values, which in this case is 1 that get transformed internally 24:00:00 since it's a time column:
=SUM(INDIRECT(""&A6&""&"!D2:D")) - SUMIF(INDIRECT(""&A6&""&"!D2:D");"24:00:00")
Here I tried to do everything with a single SUMIF but I have no idea how. NOT("24:00:00") didn't work so I settled to this.
The last part is the most difficult and I'm not able to solve it.
I have a column with month names (for example) and I want to sum some data only when the month name contains "er". Here is what I thought:
=SUMIF(A6:A16,ISNUMBER(Find("er")),G6:G16)
This gives me always 0
(Note that the last one contains A6:A16 instead of the whole INDIRECT part because I am still testing it in a single sheet.)
Any Idea what I'm doing wrong?
I don't know why the above SUMIF doesn't work, what I've tested and works is:
=SUMIF(A6:A16,"*er*",G6:G16)
SUMIF is NOT SUM + IF as I thought. I hope it will help someone else.

Resources