I have the query:
=QUERY('All Couriers'!A4:Z,"SELECT * WHERE " & IF(ISBLANK(D2),"H IS NOT BLANK","F > date'"&TEXT(D2,"yyyy-MM-dd")&"' ") & IF(ISBLANK(D3),," AND C="&D3))
where:
D2 = date in YYYY-MM-DD;
D3 = Integer between 1 and 5 (inclusive)
The goal is to have the user change D2 and D3 and adjust the tables, sheets, etc, accordingly. Testing for D2 = 2016-03-11 and D3 = 2 should yield many rows of data but currently returns empty range.
If I leave D3 blank, everything works as it should (only shows data after week in D2). I don't understand why both things do not work simultaneously. When I select the whole formula do see the "preview" of what it is doing it appears to make a well formed query like:
SELECT * WHERE F > date'2013-03-11' AND C=2