Google-sheets – Query or filter the data where the start time is past 3:00 pm

filterformulasgoogle sheetsgoogle-sheets-datesgoogle-sheets-query

I've started using Google Sheets for our logbook and it's been a great help. I have data with a time component in it (start and end time) and I'd like to query or filter the data where the start time is past 3:00 pm. I tried looking it up but most answers are with regards to the date. Any help, please? Column C contains the start time and Column D contains the End time.

Best Answer

The query would be like this:

=query(A:D, "select * where C > timeofday '15:00:00' ")

(or >= if you want to include 3 PM sharp)

Here, the single-quoted string 15:00:00 is preceded by the keyword timeofday, indicating its meaning. This is similar to how date strings are preceded by date. Note that the format of query string is fairly rigid: it has to be 24-hour time, with the seconds field included (HH:mm:ss). However, the time data in your spreadsheet can be in whatever format you want.

See scalar functions for more examples of manipulation with timeofday values.