4

I have a column in Sheet1 that contains dates in format DD/MM/YYYY, like this:

12/10/2015
28/09/2015
28/09/2015
28/09/2015
28/09/2015
28/09/2015
28/09/2015
26/10/2015
26/10/2015
26/10/2015
26/10/2015
12/10/2015
12/10/2015
12/10/2015

And I'm trying to select with a QUERY all the entries that are less than 15/10/2015. I know there are other methods but I need to use SQL syntax (this is a simplified version of the big formula and I need SQL to make the other bits work).

=QUERY(IMPORTRANGE("BLABLABLA", "Sheet1!A2:A"),"SELECT * WHERE Col1 <= '15/10/2015'")

But the query completes with an empty response. I even tried to use the MM-DD-YYYY format in the QUERY or just "2016"—still an empty response.

My spreadsheet’s locale is UK.

1

Replace

WHERE Col1 <= '15/10/2015'

with

WHERE Col1 <= date '2015-10-15'

That is, you need to provide date in ISO format and precede it with the keyword date so that it is parsed accordingly.

  • Is there a way to sort the output? I tried adding ORDER BY Col1, but it acts weird. I think I need again to specify that they're dates? – MultiformeIngegno Nov 18 '15 at 10:32
  • Order by Col1 works fine for me. Can you give an example of input and output, preferably as another question? – user79865 Nov 18 '15 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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