如何通过多个标准确定平均值,包括在计算中忽略零值。

huangapple go评论60阅读模式
英文:

How to determine averages by multiple criteria including ignoring zeros in the calculations

问题

=averageifs(b:b, ">0", c:c, "Fresh") ... 返回 "您为此函数输入的参数太少。"

也尝试过:=averageifs(b:b, ">0", a:a, e2, c:c, f1) ... 结果相同

英文:

I'm trying to create an averageifs statement that will go through a dataset and for each month, calculate the average (ignoring zero values) of two different columns). I'm not sure how to add a sample dataset to this question?

=averageifs(b:b, ">0", c:c, "Fresh") ... yields "you've entered too few arguments for this function."

also tried: =averageifs(b:b, ">0", a:a, e2, c:c, f1) ... same result

One can be downloaded from here: https://image-files-manausa.s3.us-west-2.amazonaws.com/Stack_Overflow_Example.xlsx

A screen capture is below:

如何通过多个标准确定平均值,包括在计算中忽略零值。

答案1

得分: 1

只是展示 averageifs() 或任何 xxxifs() 函数中设置条件的三种方式的示例:

如何通过多个标准确定平均值,包括在计算中忽略零值。

我使用第三个版本,其中引用了一个单元格,因为这是最灵活的。

英文:

Just to show 3 ways of setting criteria in averageifs() or any of the xxxifs() functions:

如何通过多个标准确定平均值,包括在计算中忽略零值。

I use the 3rd version where a cell is referenced as that is the most flexible.

答案2

得分: 0

我添加了一些命名范围以避免混淆。这是一个可行的解决方案:

=IFERROR(AVERAGEIFS(Dates, Time, ">0", Dates, ">=" & E2, Dates, "<=" & EDATE(E2,1), Type, $F$1), "")

其中:

  • Dates 是 a2:a35
  • Time 是 b2:b35
  • Type 是 c2:c35
英文:

I added a few named ranges to keep my head from spinning. This is a working solution:

=IFERROR(AVERAGEIFS(Time,Time,">0",Dates,">="&E2,Dates,"<="&EDATE(E2,1),Type,$F$1),"")

Where Dates is a2:a35
Time is b2:b35
Type is c2:c35

huangapple
  • 本文由 发表于 2023年5月25日 00:01:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76325436.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定