Query works fine if I change Hudson F to Automatic, if I change it to date it stops working. I need to view F as date and have the query work

=QUERY(Hudson2000!1:6634, "SELECT A, B, C, D, F, G WHERE F >= "&A2&" AND F <= "&B2)


The problem occurs because Google Sheet cells and QUERY data type are the same.

Instead of A2 and F2 use TEXT(A2,"YYYY-MM-DD") and TEXT(F2,"YYYY-MM-DD") and enclosed inside date 'xxxx' where xxxx is the place for the date.

The resulting formula is the following:

=QUERY(Hudson2000!1:6634, "SELECT A, B, C, D, F, G WHERE F >= date '"&TEXT(A2,"YYYY-MM-DD")&"' AND F <= date '"&TEXT(F2,"YYYY-MM-DD")&"'")

| improve this answer | |
  • Thank you for your help but for some reason its still now working. Can i share the file with you somehow to take a closer look? – Pierre Jean Jouve Oct 4 '18 at 16:43
  • I got it working with your query, just had to change the F2 to B2. Thank you very much for all your help. – Pierre Jean Jouve Oct 4 '18 at 16:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.