Reputation: 45
I am looking to merge both query formulas together but am having problems. The first query is returning results based on two text criteria from a drop-down list (C1 and C2) and the second is the date range (F1 and F2). Both queries work separately. I want to have one query that will pull the criteria in C1 and C2 based on the date range in F1 and F2.
I have tried an array formula but keep getting an error. Any help or suggestions would be appreciated.
Text Criteria Query:
=QUERY(Sheet1!A1:BL, "select A, E, X, S, V, T, AU, AC where A= """&C1&""" AND AC= """&C2&"""")
Date Range Query:
=QUERY(Sheet1!A1:BL, "select A, E, X, S, V, T, AU, AC where E >= DATE """&TEXT(F1,"yyyy-MM-dd")&""" AND E <= DATE"""&TEXT(F2,"yyyy-MM-dd")&""" ")
Upvotes: 0
Views: 2630
Reputation: 2660
How about:
=QUERY(Sheet1!A1:BL, "select A, E, X, S, V, T, AU, AC where
A= "&C1&" AND AC= "&C2&" and
E >= DATE '"&TEXT(F1,"yyyy-MM-dd")&"' and
E <= DATE '"&TEXT(F2,"yyyy-MM-dd")&"'")
You should use single quote within query for date values and strings. Here I assume that C1 and C2 are numbers thus I don't use additional single quotes. If C1 and C2 are strings you should make this line:
A= '"&C1&"' AND AC= '"&C2&"' and
Upvotes: 1