Google Spreadsheet, how to grab row from other sheet using vlookup? - arrays

I got two sheets in my google spreadsheet:
MC
Items (rather big)
In "MC i got a column with different Item Names.
I need to find the matching ID from sheet "Items".
Created a vlookup for it, but cant get it to work - everything looks okay to me.
Link to sheet:
https://docs.google.com/spreadsheets/d/1Yif8Cf1g1pPI38YFCffDKQ1tE-08SWPSfRAv-TdWXTw/edit?usp=sharing
=VLOOKUP(B2,Items!$A$2:B,2,false)
What am I doing wrong here?

try:
={"id"; ARRAYFORMULA(IFNA(VLOOKUP(B2:B, {Items!B:B, Items!A:A}, 2, 0)))}

Related

Google Sheets: Using Transpose on an array in other tabs & identifying the tab by

I would appreciate some help, please.
I have a google sheet with many tabs with data going horizontally.
I would like to create a formula that imports and transposes the data into a vertical list.
However, I want to be able to type in (or drop-down list) to select the tab which the transpose formula to look at. I cannot get anything to work. I have tried this
=TRANSPOSE(A1&!B2:J2)
To add to that if it could use a lookup (vlookup or hlookup) to find the correct row to transpose then that would be great also.
I have set up a test sheet below. Please help. Many Thanks Tim https://docs.google.com/spreadsheets/d/1Menn6Z1mLl8wYOrcdQFnfs7Lp0dbC9UJe1S3AQRcOS0/edit#gid=0
You should not use IMPORTRANGE to work with data that exists anywhere in the same spreadsheet. IMPORTRANGE is for use retrieving data from a separate spreadsheet.
Instead, delete your current Sheet1!A2 formula and replace it with this:
=ArrayFormula(TRANSPOSE(INDIRECT(A1&"!B16:J16")))
I also added a new sheet ("Erik Help") with an advanced formula that accomplishes your lookup using whatever is types in B1. If whatever is typed in B1 exists in Column A of the selected sheet, the results of that row will be retrieved. If no match is found, IFERROR will return "No Match Found."
That formula, in 'Erik Help'!A2:
=ArrayFormula(IFERROR(QUERY(TRANSPOSE(INDIRECT(A1&"!B"&VLOOKUP("*"&B1&"*",{INDIRECT(A1&"!A:A"),ROW(INDIRECT(A1&"!A:A"))},2,FALSE)&":"&VLOOKUP("*"&B1&"*",{INDIRECT(A1&"!A:A"),ROW(INDIRECT(A1&"!A:A"))},2,FALSE))),"Select * WHERE Col1 Is Not Null"),"No Match Found"))

Google Sheet Query Formula

Is there any way that without importing the data in helping sheet we can use vlookup as I have created in Sheet1 to lookup the values from other sheet “Directly” by using IMPORITNG (Query formula?
Here is current formula.
=ArrayFormula({"Comments";IF(A2:A="","",IFERROR(VLOOKUP(TRIM(A2:A)&B2:B&"|"&C2:C&D2:D,{TRIM('Sheet1 Import'!A2:A)&'Sheet1 Import'!B2:B&"|"&'Sheet1 Import'!C2:C&'Sheet1 Import'!D2:D,'Sheet1 Import'!E2:E},2,FALSE),"*** NOT FOUND ***"))})
But above formula is taking the data from helping sheet I am trying to create a formula that directly match the result and take relevant data from another sheet.
I have created this formula but its not working ?
=INDEX(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1x7ofB9Rt-y5_DlaxQVIZK_ZKR8sqBHVxAu3ZZlU13YA/edit#gid=0", "Sheet1!E:E"),MATCH(1,(A2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1x7ofB9Rt-y5_DlaxQVIZK_ZKR8sqBHVxAu3ZZlU13YA/edit#gid=0", "Sheet1!A2:A")(B2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1x7ofB9Rt-y5_DlaxQVIZK_ZKR8sqBHVxAu3ZZlU13YA/edit#gid=0", "Sheet1!B2:B")(C2,IMPORTRANGE("https://docs.google.com/spreadsheets/d/1x7ofB9Rt-y5_DlaxQVIZK_ZKR8sqBHVxAu3ZZlU13YA/edit#gid=0", "Sheet1!C2:C"),0)))))
Sheet links
https://docs.google.com/spreadsheets/d/1x7ofB9Rt-y5_DlaxQVIZK_ZKR8sqBHVxAu3ZZlU13YA/edit#gid=0
https://docs.google.com/spreadsheets/d/1_9Vumt1a-1WnrXAHOpJd1GUTQ3jLjPifwGyKlDDRyi0/edit?usp=sharing
From the question
Is there any way that without importing the data in helping sheet we can use vlookup as I have created in Sheet1 to lookup the values from other sheet “Directly” by using IMPORITNG (Query formula?
One way is to add the VLOOKUP formula on the source spreadsheet then import the result. Another way is to use Google Apps Script.

Find name in one column, return value from another

I have a spreadsheet with responses from a Google Form. They sign up for one of our trivia games, then I make a spreadsheet for each game. I wrote a FILTER function in the corresponding Google Sheet that gives me a list of all the players' names.
What I need is a function to reference the team name from the Responses sheet and give me the information in my filtered game sheet. I would like a function rather than a Javascript script to run manually. I am certain this can be done but the function methodology is escaping me.
As an example, I have created a spreadsheet in Google Sheets with some data. Can someone help me write a formula to put team names in "The Office" tab? Thanks in advance.
https://docs.google.com/spreadsheets/d/1F2bgvHXqA2wNUa98rfESWTeK22va1RMQUjnk6ma2AeA/edit?usp=sharing
In B2 try this formula
=ArrayFormula(if(len(A2:A), vlookup( match("*"&A2:A&"*", 'Form Responses'!C:C, 0), {row('Form Responses'!A:A), 'Form Responses'!B:B}, 2, 0),))
and see if that helps?
Looks like you need a VLOOKUP which grabs the value of the matching row of whatever criteria you specify. The only issue was that VLOOKUP requires the column of values being returned to be after the "lookup column" which meant moving the team names column to column D.
Here is the formula: =VLOOKUP("*"&A2&"*",'Form Responses'!C$2:D$23,2, FALSE)
I also went ahead and implemented it in your linked spreadsheet.
use in B2:
=ARRAYFORMULA(IF(A2:A="",,IFNA(VLOOKUP("*"&A2:A&"*", 'Form Responses'!C2:D, 2, 0))))

Import data from another sheet using ID but only some columns

I have a google sheet like this :
And another one like this :
I want in the second google sheet to pull data from the first sheet that matches those IDs
I have tried index & match, vlookup, lookup but none of them got me to my point especially with using importrange to pull data from the second file I couldn't solve my
Thanks in advance for your help
This is where I am trying to make the magic happen if you are wondering :
https://docs.google.com/spreadsheets/d/1TZYo641Av4SHaHLjSPuAZv3DSnVw0pqSubbtsiYw8Uk/
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, {Mother!B:B, Mother!A:A, Mother!C:D}, {2,3,4}, 0)))

Trouble with ARRAYFORMULA for auto-filling formulas in Google Sheets

I'm attempting to automatically populate a Google Sheets column in a "Results" sheet with the following formula, which draws data from a "Source" spreadsheet:
=IFERROR(INDEX(Source!$B$2:$D,MATCH($A2&C$1,Source!$B$2:$B&Source!$C$2:$C,0),3)," ")
When I place that formula in ARRAYFORMULA, it does not auto-populate, and changing the MATCH search_key to a range (i.e., $A2:$A&C$1) does not fix the problem.
I.e., neither of these work:
=ArrayFormula(IFERROR(INDEX(Source!$B$2:$D,MATCH($A2&C$1,Source!$B$2:$B&Source!$C$2:$C,0),3)," "))
=ArrayFormula(IFERROR(INDEX(Source!$B$2:$D,MATCH($A2:$A&C$1,Source!$B$2:$B&Source!$C$2:$C,0),3)," "))
Is there a way to fix this? Or an alternative way to automatically fill a formula? I'm also open to using a function other than INDEX/MATCH, so long as it can do a lookup based on two vertical criteria. Unfortunately I don't think a pivot table would suit my purposes, since my "Results" page also queries another spreadsheet to provide other information.
Example here: https://docs.google.com/spreadsheets/d/1dsaMYsJeZl2o_rNTLwaVhnEehFvAKRMXghAJeEK220s/edit?usp=sharing
This is the formula you are looking for:
=ARRAYFORMULA(IFERROR(HLOOKUP(Source!$D$2,Source!$D$2:$D$11,MATCH($A2:$A4&C$1,ARRAYFORMULA(Source!$B$2:$B&Source!$C$2:$C),0),0),0))
I tested this and it works perfectly fine.
TL;DR
To answer why your formula is wrong,
The second argument in MATCH should have an ARRAYFORMULA otherwise you are basically matching only with first element.
INDEX doesn't work with ARRAYFORMULA. It can only search for a single value in a given range.
The first part can be solved by adding ARRAYFORMULA inside MATCH.
A simple VLOOKUPcould have solved the second problem if you weren't searching for a combination of cells (Date and Name). A twisted HLOOKUP comes to your rescue.
Without the IFERROR part, the formula looks like this:
=ARRAYFORMULA(HLOOKUP(Source!$D$2,Source!$D$2:$D$11,MATCH($A2:$A4&C$1,ARRAYFORMULA(Source!$B$2:$B&Source!$C$2:$C),0),0))
This formula produces the same output (see cell I1):
=QUERY({Source!A:D,ARRAYFORMULA(VLOOKUP(Source!B:B,'Project Lookup'!A:B,2,0))},"select Col2,Col5,sum(Col4) where Col1 is not null group by Col2,Col5 pivot Col3")

Resources