Search code examples
google-sheetsarray-formulas

Get max value from each day from a range of time using google sheets arrayformula


Example

There is range A that stores time and its value and it gets updated dynamically (not in the example).

From that range A, I want to make a dynamic range B of each day and its max value.

Filter() doesn't work with arrayformula and I don't know if query works with it too.


Solution

  • You can do it just with a query:

    =ArrayFormula(query({int(A4:A),B4:B},"select Col1,max(Col2) where Col2 is not null group by Col1 label Col1 'Date'"))
    

    as long as you format the date column in the result appropriately.

    enter image description here

    EDIT

    To remove the column labels, just put an empty string as below:

    =ArrayFormula(query({int(A4:A),B4:B},"select Col1,max(Col2) where Col2 is not null group by Col1 label Col1 '',max(Col2) ''"))