[英]How can i calculate the average per hour?
I need to plot my data, but just a value per hour, the problem here is sometimes I have just one value at that hour, but other times I can have 4 our 5 readings at the same hour; 我需要绘制数据,但每小时仅一个值,这里的问题是有时我在那个小时只有一个值,但是其他时候我可以在同一小时获得4个5个读数; so How can I calculate the average per hour? 那么如何计算每小时的平均值?
thanks! 谢谢!
Assuming date/times in A2
down and values in B2
down try this formula in C2
假设A2
向下的日期/时间和B2
向下的值,请在C2
尝试此公式
=AVERAGEIFS(B:B,A:A,">="&FLOOR(A2,"1:00"),A:A,"<"&CEILING(A2,"1:00"))
FLOOR
function will round down to the hour and CEILING
will round up so this averages between 01:00
and 02:00
etc. FLOOR
函数将向下舍入到小时,而CEILING
将向上舍入,因此其平均值在01:00
到02:00
之间,以此类推。
The above version will give you the average on every row (with repeats). 上面的版本将为您提供每行的平均值(重复)。 If you alter it like this then the average will only appear on the last value for each hour 如果您这样更改,则平均值只会出现在每小时的最后一个值上
=IF(FLOOR(A2,"1:00")<>FLOOR(A3,"1:00"),AVERAGEIFS(B:B,A:A,">="&FLOOR(A2,"1:00"),A:A,"<"&CEILING(A2,"1:00")),"")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.