0
votes

I am trying to query a google sheet by date. I have done some research and learned I need to convert to TEXT format so that I can run the comparison, but I am not able to get the syntax correctly:

=query('SheetName'!$A2:$S, "select A Where O=date'"&TEXT(B2,"yyyy-mm-dd")&)

Could you give me some guidance?

Some more info: in my query, B2 is a valid date in date format. Column O has some cells that are text strings and others that are valid dates; I have set the format of the entire column to "Date".

Here is a link to a simple example, feel free to play around with the query: https://docs.google.com/spreadsheets/d/1O4ms9ufvZ_CRLl_LG45hksjRoOJtv0XexbfjCLqFW4I/edit?usp=sharing

2

2 Answers

0
votes

See if this works?

=filter('SheetName'!A3:A, 'SheetName'!O3:O=B2)
0
votes

correct syntax should be:

=ARRAYFORMULA(QUERY(TO_TEXT(SheetName!$A2:$S),
 "select Col16 where Col15 = '"&TO_TEXT(DATEVALUE(B2))&"'"))

0