Arturo Paz
Arturo Paz

Reputation: 11

Google sheets query inside select string in a where clause how to use reference cells with dates in them as filters

=QUERY(customers,"SELECT B, G, F, E, M WHERE F >= DATE '2020-6-1' AND F <= DATE '2020-6-7',0)

I have this string inside a Google Sheets Query.

I want to replace the two dates with a cell for each to simplify adjusting the dates every week at the cell and not the actual function.

How can I do that?

Upvotes: 0

Views: 167

Answers (1)

JPV
JPV

Reputation: 27302

See if this helps

=QUERY(customers,"SELECT B, G, F, E, M WHERE F >= DATE '"&TEXT(A1, "yyyy-MM-dd")&"'  AND F <= DATE '"&TEXT(B1, "yyyy-MMM-dd")&"'",0)

Change the cell references as needed. Depending on your locale you may have to change the commas in the formula to semi-colons.

Upvotes: 1

Related Questions