Search code examples
sortinggoogle-sheetsgoogle-sheets-formulamingoogle-sheets-query

Google sheets find MIN time of min price


Given the following data:

123 2020-06-22 23:00:00
124 2020-06-22 23:30:00
121 2020-06-23 00:00:00

I want the hour/minute of the minimum price in a Google Sheet. I tried using without success:

=QUERY(A:B,"select hour(B), min(A) group by todate(B)")
=QUERY(A:B,"select B, min(A) group by todate(B)")

Solution

  • try like this:

    =INDEX(SORT(A:B); 1)
    

    0


    or for each date:

    =ARRAY_CONSTRAIN(SORTN(SORT({A:B, DATEVALUE(B:B)}), 9^9, 2, 3, 1), 9^9, 2)
    

    enter image description here