I'm trying to create a sheet that only shows me LOT Codes of specific products from a different workbook that has all of our products and LOT Codes.

From what I've seen the Query with Import Range function seems to be the best way to go about this but for some reason, I can't get my formula to work. My Import Range function works with no problems on its own but, when I stick it into my Query I keep getting the #ERROR! message.

Can someone tell me what I am doing wrong?

=QUERY(=IMPORTRANGE("https://docs.google.com/spreadsheets/d/14SDJBScp8JFf9Gt_AgXstwo1cE9sCEiBeNp2uYcPKiU/edit#gid=1571391866",C1&"!A:E"),"select Col5 where Col1 contains '"&$B$3&"'")

enter image description here

1 Answer 1


Your formula should be:

=QUERY(IMPORTRANGE("14SDJBScp8JFf9Gt_AgXstwo1cE9sCEiBeNp2uYcPKiU", C1&"!A:E"),
 "select Col5 where Col1 contains '"&B3&"'", 0)

  • 1
    Worked like a charm! Thanks!!
    – Abie
    Commented Jul 24, 2019 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.