Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
    
Please create a demo spreadsheet with sample data. – Rubén 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.