Search code examples
datedatetimegoogle-sheetsgoogle-query-language

Query timestamps in Google Sheets looking for specific date but ignoring the time


I have a range of data with a timestamp in the first column. I want the average of a particular column (AF) for a specific date, regardless of what time the timestamp has.

The formula I'm currently working on looks something like this but it returns an empty result set although I can see the data is present.

=query(ImportedData1!A1:AF, "Select avg(AF) where A = date '2019-04-08' label avg(AF) '' ", 0)

What am I doing wrong, please?


Solution

  • See if this helps

    =query(ImportedData1!A1:AF, "Select avg(AF) where toDate(A) = date '2019-04-08' label avg(AF) '' ", 0)