我有一个很大的温度和湿度读数数据集,一年中每半小时收集一次。我想获得白天和夜晚的平均温度,但我对 averageifs 的实验到目前为止都失败了。据我所知。
=AVERAGEIFS(Sheet1!D$7:D$17622,Sheet1!$C$7:$C$17622, ">="&$A21, Sheet1!$C$7:$C$17622,"<" &$A22)
A21和A22中的值为6:00和18:00,格式为h:mm。
这只会返回一个 DIV/0!错误 - 我没有任何零,所以我不知道问题出在哪里。
我有完全相同的日期公式。这两个公式都使用相同的输入,像这样输入到每个单元格中:
1/02/2016 3:00:00 PM
如果有任何帮助,我将不胜感激(或者如果这是错误的论坛,请告诉我)。
最佳答案
您的问题是您指定的范围的大小。
来自documentation :
Syntax:
AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2],...)
The
AVERAGEIFS
function syntax has the following arguments:
Average_range
Required. One or more cells to average, including numbers or names, arrays, or references that contain numbers.
Criteria_range1, criteria_range2, …
Criteria_range1 is required, subsequent criteria_ranges are optional. 1 to 127 ranges in which to evaluate the associated criteria.
Criteria1, criteria2, …
Criteria1 is required, subsequent criteria are optional. 1 to 127 criteria in the form of a number, expression, cell reference, or text that define which cells will be averaged. For example, criteria can be expressed as32
,"32"
,">32"
, "apples"
, orB4
.Unlike the range and criteria arguments in the
AVERAGEIF
function, inAVERAGEIFS
each criteria_range must be the same size and shape as sum_range.
因此,使用 AVERAGEIFS
, SUMIFS
, COUNTIFS
,如果要计算的范围(第一个参数)是,例如,A1:A10
,那么您指定的所有条件范围也必须跨越 10 个单元格。
您可能错误地使用了 AVERAGEIFS
而不是 AVERAGEIF
.
如果您有单行条件并且想要平均一行或多行数据,请使用
AVERAGEIF
.如果您有多个条件(即在此时间之前和该时间之后)并且想要平均一行数据,请使用
AVERAGEIFS
.
我认为您不能将两者用于多个条件 + 多个数据行。如果那是你想要做的,你可能需要使用 SUMIFS
和 COUNTIFS
对于每一行,然后从中计算平均值。
例如:
如果您想平均白天温度(06:00 到 18:00 之间)
时间存储在
A1:X1
中喜欢00:00
至23:00
(*并且不附加日期,即使不“可见”)温度存储在
A:X
列中(每行一天)并且您想计算一天的平均日间温度,该温度存储在第 2 行,
...那么你可以使用:
=AVERAGEIFS(A2:X2,A1:X1,">="&6/24,A1:X1,"<&18/24)
请注意,当根据开始/结束日期/时间计算总数时,通常最好使用:
>=
开始日期/时间,以及<
结束日期/时间
...防止重叠。
此外,当涉及到像这样更复杂的公式时,请务必手动计算几行以比较并验证您是否正确指定了公式标准。
更多信息:
Office.com:AVERAGEIFS function
Office.com:AVERAGEIF function
Office.com:SUMIFS function
Office.com:COUNTIFS function
Exceltip.com : AVERAGEIFS, SUMIFS and COUNTIFS Functions in Microsoft Excel
关于excel - excel日夜平均温度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49147935/