QUERY Data from an external sheet with conditions on data from both sheets

I kind of need your help on this. I have 2 separate spreadsheets:

Spreadsheet A:

ColA   ColB
AA1    Want1
AA2    Want2
AA3    Want3

Spreadsheet B:

ColC   ColD
AA3    <Display Correctly In Here>
AA1    ...
AA2    ...

I tried using the following formula (because I need them to fill automatically):

=QUERY(IMPORTRANGE("LinkOfSheetA", "SheetA!A2:B"), 
"Select Col2 WHERE Col1=C")

I figured that either I cannot do it this way or that I do not know how to point back to ColC in SheetB. Really need your help, Thanks!

Upvotes: 1

Views: 1078

Answers (2)

TheMaster
TheMaster

Reputation: 50416

=ARRAYFORMULA(VLOOKUP(C2:C25,IMPORTRANGE("LinkOfSheetA", "SheetA!A2:B"),2,0))

Upvotes: 2

pnuts
pnuts

Reputation: 59440

I think what you are looking for is, in Spreadsheet B D2 and copied down to suit, something like:

=QUERY(IMPORTRANGE(" k e y ","SheetA!A2:B10"),"select Col2 WHERE Col1='"&C2&"' ")

Upvotes: 1

Related Questions