Search code examples
google-sheets-querygoogle-sheets-formula

Google Sheets - Import Range within a Query


Trying to run a query with an import range function built into it, but I keep getting an ERROR message. Here is the formula I am trying to use: =QUERY(IMPORTRANGE("1BJ11UiLyiK3PaS2iwHEsyuMMXomdvrEkYYj_Z7bWWw4","Sheet1!A:C"),"Select Col2 where Col1 = '"A1"' ")

I've tested the import range formula without the query and that goes through successfully so it must be something with how I am writing the query.


Solution

  • You just need to add ampersands (&). Try this:

    =QUERY(IMPORTRANGE("1BJ11UiLyiK3PaS2iwHEsyuMMXomdvrEkYYj_Z7bWWw4","Sheet1!A:C"),"Select Col2 where Col1 = '"&A1&"' ")
    

    Cheers.