0
votes

I'm hoping to do a VLOOKUP in a different Google Sheet based on 2 criteria: sheet name and then the lookup value. My data looks something like this:

A1            B1              C1
Sheet_Name    Lookup_Value    Lookup_Value
Sheet_1       123456          =vlookup(B3,"Sheet_1!$A$1:$C$1000",2,false)
Sheet_1       987456          =vlookup(B4,"Sheet_1!$A$1:$C$1000",2,false)
Sheet_2       654123          =vlookup(B5,"Sheet_2!$A$1:$C$1000",2,false)
Sheet_3       959595          =vlookup(B6,"Sheet_3!$A$1:$C$1000",2,false)
Sheet_3       621346          =vlookup(B7,"Sheet_3!$A$1:$C$1000",2,false)

Is there a way I can choose the sheet in my vlookup equation based on the value in column A rather than going in manually and updating this?

Currently, I'm trying this, but it's not working:

=vlookup(B3,importrange("key_here",indirect(A3)&"!A1:C1000"),2,false)
2

2 Answers

0
votes

Use INDIRECT:

=vlookup(B3,INDIRECT("'"&A3&"'!$A$1:$C$1000",2,false)
0
votes

Figured it out: Google doesn't require the indirect function. So what works is:

=vlookup(B3,importrange("key_here",A3&"!A1:C1000"),2,false)