Search code examples
dategoogle-sheetsgoogle-sheets-formulagoogle-sheets-queryimportrange

Import from another sheet using QUERY IMPORTRANGE but query where is from current sheet


I'm using query and import range to get from another sheet. Example

=query(IMPORTRANGE("KEY","Form Responses 1!A:L"), "select * where J = '2020-02-01' ")

I want the where part of the query to be driven from a cell on the current sheet, which contains a date. Something like

=query(IMPORTRANGE("KEY","Form Responses 1!A:L"), "select * where J = A1")

How can I use the value from a cell in the current sheet to drive the import query where?


Solution

  • You can use it on cell reference. You have to set the a1 notaion between: '"& A1 &"'

    See this post: QUERY syntax using cell reference