Search code examples
dategoogle-sheetsfilterimportgoogle-sheets-formula

Unable to combine Date Criteria in Query Function in Google Sheets


I am using query and importrange function to collect data from another Google sheet, i have already filtered a column, but now i have to filter FROM the main sheet on a date column (ABOVE MAY 2022) in the Query function. this is my actual function that i have tried but it doesnt works. I would appreciate some help with this.

=QUERY(IMPORTRANGE("2WdjuvMkDmxjFT6IgQmXeQ8xn1fs5T-JkSVar86P7KdQ";"A:D");"Select Col1, Col3, Col4 Where Col3 contains 'Santa Cruz' and where Col1 = date '"&TEXT(A2,"yyyy-mm-dd")&"'")

Solution

  • you are allowed to use where only once:

    =QUERY(IMPORTRANGE("2WdjuvMkDmxjFT6IgQmXeQ8xn1fs5T-JkSVar86P7KdQ"; "A:D");
     "select Col1,Col3,Col4 
      where Col3 contains 'Santa Cruz' 
        and Col1 = date '"&TEXT(A2,"yyyy-mm-dd")&"'")