能否将Excel的AVERAGEIF与AGGREGATE函数结合使用?

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

Is there a way to combine Excel AVERAGEIF with AGGREGATE?

问题

我有一个包含阶段(阶段1,阶段2等)和每个阶段的百分比值的电子表格列。每个阶段都有多个百分比值,我想计算每个阶段的平均百分比。

我之前使用AVERAGEIF来计算每个阶段的平均百分比:

AVERAGEIF(Table1[PHASE], "Phase 1", Table1[PERCENTAGE]) 等等。

这个方法很好用。然而,如果任何百分比值是“N/A”或者错误,我不希望它们影响计算结果。

我了解到AGGREGATE可以忽略错误,但它只适用于AVERAGE,而不适用于AVERAGEIF。我也了解到AVERAGEIF(A1:A5, ">=0")以及用于多个错误值的AVERAGEIFS,但这不允许我比较PHASE列。

欢迎任何建议。

英文:

I have a spreadsheet with a col of phases (Phase 1, Phase 2, etc.) and col of percentage values for each phase. There are multiple of each phase and I want to calculate the average % for each phase.

I was using AVERAGEIF to calculate the average percentage for each Phase:

AVERAGEIF(Table1[PHASE], "Phase 1", Table1[PERCENTAGE]), etc.

That works fine. However, if any percentage values are N/A or errors, I don't want this to skew the calculations.

I read about AGGREGATE that ignores errors, but that only works with AVERAGE, not AVERAGEIF.
I also read about AVERAGEIF(A1:A5,">=0") and AVERAGEIFS for multiple error values, but this doesn't allow me to compare the PHASE col.

Any suggestions welcome.

答案1

得分: 2

对于Microsoft 365,请尝试以下公式...

=AVERAGE(FILTER(Table1[PERCENTAGE],(Table1[PHASE]="Phase 1")*(ISNUMBER(Table1[PERCENTAGE]))))

对于早期版本,请尝试以下需要使用CONTROL+SHIFT+ENTER确认的公式...

=AVERAGE(IF(Table1[PHASE]="Phase 1",IF(ISNUMBER(Table1[PERCENTAGE]),Table1[PERCENTAGE])))

然而,您提到包含百分比值的列包含错误值,以及文本值"N/A"。如果错误值是相同类型的,假设是#DIV/0!,您可以简单地使用以下公式...

=AVERAGEIFS(Table1[PERCENTAGE],Table1[PERCENTAGE],"<>#DIV/0!",Table1[PHASE],"Phase 1")

相应地更改要测试的错误值。

英文:

For Microsoft 365, try the following formula...

=AVERAGE(FILTER(Table1[PERCENTAGE],(Table1[PHASE]=&quot;Phase 1&quot;)*(ISNUMBER(Table1[PERCENTAGE]))))

For earlier versions, try the following formula that needs to be confirmed with CONTROL+SHIFT+ENTER...

=AVERAGE(IF(Table1[PHASE]=&quot;Phase 1&quot;,IF(ISNUMBER(Table1[PERCENTAGE]),Table1[PERCENTAGE])))

However, you say that the column containing the percentage values contain error values, in addition to the text value "N/A". If the error values are the same type, let's say #DIV/0!, you can simply use the following formula instead...

=AVERAGEIFS(Table1[PERCENTAGE],Table1[PERCENTAGE],&quot;&lt;&gt;#DIV/0!&quot;,Table1[PHASE],&quot;Phase 1&quot;)

Change the error value for which to test accordingly.

huangapple
  • 本文由 发表于 2023年6月8日 07:37:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76427710.html
匿名

发表评论

匿名网友

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

确定