简体   繁体   English

计算每个日期的值的总和,并返回最高的总和

[英]Calculate the sum of values for each date, and return the highest sum

I have the following theoretical fields: Date and Hours Played and three rows:我有以下理论领域: DateHours Played以及三行:

  • 1st row: the Date column has the value "1/12/2016", while the Hours Played column has the value "2".第一行:日期列的值为“1/12/2016”,而播放时间列的值为“2”。

  • 2nd row: the Date column has the value "1/12/2016", while the Hours Played column has the value "2".第二行:日期列的值为“1/12/2016”,而播放时间列的值为“2”。

  • 3rd row: the Date column has the value "1/06/2016", while the Hours Played column has the value "3.5".第三行:日期列的值为“1/06/2016”,而播放时间列的值为“3.5”。

If I use the =MAX() function, the day with the most hours played will be 1/06/2016 with 3.5 hours.如果我使用=MAX()函数,播放时间最多的一天将是 1/06/2016,有 3.5 小时。 However, in reality the day with the most hours played is 1/12/2016 with 4 hours total.然而,实际上播放时间最多的一天是 1/12/2016,总共 4 小时。

Does anyone know of a function to use that would return the highest sum of the hours played for each date (in this case: 4 ).有谁知道要使用的函数可以返回每个日期播放的最高小时数总和(在这种情况下: 4 )。

The query function is appropriate here. query功能在这里是合适的。 If the dates are in column A and hours are in column B, it could look like如果日期在 A 列中,小时在 B 列中,则它可能看起来像

=query(A:B, "select sum(B) group by A order by sum(B) desc limit 1 label sum(B) ''")

Meaning: sum B, grouping by A, return the highest value, don't label it.含义:sum B,按A分组,返回最高值,不标注。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM