Google Sheets Import Range Query Error – Troubleshooting Guide

formulasgoogle sheetsgoogle-sheets-queryimportrange

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

Best Answer

Your formula should be:

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