Search code examples
google-sheetsgoogle-sheets-formulaarray-formulasgoogle-sheets-querygoogle-query-language

Get all the timestamp values from a range, within the past 24 hours


I have a Google Forms data where I only want to perform the past 24 hours of inputs. The formula I am using is:

=ARRAYFORMULA(QUERY('Production Log'!A:A,"Select A where hour(timevalue(now())-timevalue(toDate(A))) <=24"))

But I am getting this error:

Error Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "hour" "hour "" at line 1, column 16. Was expecting one of: "(" ... "(" ...


Solution

  • Filter may be simpler:

    =filter('Production Log'!A:A,(now() - ('Production Log'!A:A)) < 1)