问题
I am trying to calculate AVERAGE from five AverageIFs:
AVERAGE(AVERAGEIFs1,AVERAGEIFs2,AVERAGEIFs3,AVERAGEIFs4,AVERAGEIFs5)
in AverageIFs2 and AverageIFs4 I am receiving #DIV/0! . How to calculate AVERAGE from AverageIFs that are not have errors only?
Adding IFERROR, IF(ISERROR) etc before AverageIf is not resolving problem.
回答1:
It's rather tedious, but you might have to do something like this:
=SUM(IFERROR(AVERAGEIFS(A1:A2,A1:A2,">"&0),0),IFERROR(AVERAGEIFS(B1:B2,B1:B2,">"&0),0),IFERROR(AVERAGEIFS(C1:C2,C1:C2,">"&0),0))
/SUM(--ISNUMBER(AVERAGEIFS(A1:A2,A1:A2,">"&0)),--ISNUMBER(AVERAGEIFS(B1:B2,B1:B2,">"&0)),--ISNUMBER(AVERAGEIFS(C1:C2,C1:C2,">"&0)))
EDIT
=SUM(IFERROR(AVERAGEIFS(A1:A2,A1:A2,">"&0),0),IFERROR(AVERAGEIFS(B1:B2,B1:B2,">"&0),0),IFERROR(AVERAGEIFS(C1:C2,C1:C2,">"&0),0))
/COUNT(AVERAGEIFS(A1:A2,A1:A2,">"&0),AVERAGEIFS(B1:B2,B1:B2,">"&0),AVERAGEIFS(C1:C2,C1:C2,">"&0))
is a bit shorter - Count ignores any #DIV/0!
来源:https://stackoverflow.com/questions/54219892/average-from-averageifs-that-will-ignore-averageifs-where-is-error-excel