Skip to content
Advertisement

Finding the daily max (and its domain) fails in spreadsheet

Following this post I have tried the same, but got an error:

I would like to get the daily max for each date, and the domain name who got this score.

=query({A8:C}, "select todate(A), B, max(C), where A is not null group by todate(A) order by todate(A) asc")

also

=query(A8:C, "select todate(A), B, max(C), where A is not null group by todate(A) order by todate(A) asc", 0)
")

enter image description here

Advertisement

Answer

For your first formula:

  • because of the array {} you’ll have to use numeric column reference
  • include the second column in the group by

See it this helps

=query({A3:C}, "select todate(Col1), Col2, max(Col3) where Col1 is not null group by todate(Col1), Col2 order by todate(Col1) asc label todate(Col1)'', Col2 '', max(Col3)''")

For your second formula:

  • include column B in the group by

Try

=query(A3:C, "select todate(A), B, max(C) where A is not null group by todate(A), B order by todate(A) asc label todate(A)'', B '', max(C)''")

Note:

  • I also added a label-clause to get rid of the headers caused by the aggregation.
  • Depending on your locale, you have to a semi-colon after the range instead of a comma.

EDIT

If you want to see which domain name got the highest score per day, you can try

=ArrayFormula(iferror(vlookup(sort(unique(A3:A)), sort(A3:C, 3, 0), {1, 2, 3}, 0)))

and see if that works?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement