AVERAGEIFS function
AVERAGEIFS averages values only when all of the listed conditions hold, such as sales for a region in a given month. It is the multi-condition version of AVERAGEIF.
Example
Read it as a sentence: average the sales in O2:O7 for rows where M2:M7 (Region) is North and N2:N7 (Product) is A, which gives 100.
Syntax
AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
Arguments in [square brackets] are optional.
-
average_range(required) - Cells to average.
-
criteria_range1(required) - First range to test.
-
criteria1(required) - Condition for the first range.
-
criteria_range2(optional) - Optional further range to test.
-
criteria2(optional) - Condition for the further range.
Returns: The mean of cells where every condition is true.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=AVERAGEIFS(Data!O2:O7,Data!M2:M7,"North",Data!N2:N7,"A") | 100 | Two criteria |
=AVERAGEIFS(Data!O2:O7,Data!O2:O7,">=100") | 150 | Numeric criteria on average range |
=AVERAGEIFS(Data!O2:O7,Data!M2:M7,{"North";"South"}) | 150 | Array criteria spill |
=AVERAGEIFS(Data!O2:O7,Data!M2:M7,"West") | #DIV/0! | No match |
=AVERAGEIFS(Data!O2:O7,Data!M2:M5,"North") | #VALUE! | Mismatched sizes |
The Data sheet these formulas read
A cell that starts with = holds that formula.
Watch out for
- average_range comes first here, unlike AVERAGEIF where it comes last.
- All ranges must be the same size or you get #VALUE!.
- Returns #DIV/0! when no row meets every condition.
- Excel refuses the formula outright if you type an array constant such as {1,2,3} where a range is expected; point it at cells instead (measured in Excel 16.0.20527).
Where it works
- Excel
- AVERAGEIFS is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Statistical functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .