Conditional totals function
AVERAGEIFS function in Google Sheets and Excel
AVERAGEIFS averages the numbers in one range for the rows that meet one or more conditions.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)Arguments in [brackets] are optional. Google Sheets writes it AVERAGEIFS(average_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...]).
Example
=AVERAGEIFS(C2:C9,B2:B9,"East") reads: Average the July figures in C2:C9 for the rows where Region (B2:B9) is "East".
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Rep | Region | Jul | Aug | Sep | Target | East Jul avg | $12,650 | |
| 2 | Amara Osei | North | $12,400 | $13,100 | $11,800 | $36,000 | |||
| 3 | Ben Fischer | South | $9,800 | $10,250 | $12,100 | $30,000 | |||
| 4 | Lina Chen | East | $15,200 | $14,800 | $16,900 | $45,000 | |||
| 5 | Diego Alvarez | West | $8,700 | $9,100 | $8,400 | $28,000 | |||
| 6 | Eva Novak | North | $11,200 | $12,600 | $13,900 | $36,000 | |||
| 7 | Farid Haddad | South | $13,300 | $12,900 | $14,100 | $39,000 | |||
| 8 | Grace Kim | East | $10,100 | $9,600 | $10,800 | $33,000 | |||
| 9 | Hugo Martin | West | $14,500 | $15,800 | $15,100 | $42,000 |
I1 shows $12,650: the average of Lina's $15,200 and Grace's $10,100 in July.
How the spreadsheet calculates it
Works out the average of C2:C9 on the rows where B2:B9 is equal to "East".
- 1. AVERAGEIFS: Works out the average of
C2:C9on the rows whereB2:B9is equal to"East".average_range=`C2:C9`: the numbers to averagerange1=`B2:B9`: the column to checkcriteria1=`"East"`: what it must match
More AVERAGEIFS examples
=AVERAGEIFS(C2:C9,C2:C9,"<>0")The July average, leaving out zeros.=AVERAGEIFS(I2:I13,E2:E13,"Plants",H2:H13,"Shipped")The average total of shipped plant orders.=IFERROR(AVERAGEIFS(C2:C9,B2:B9,I2),"No reps")The average for the region in I2, with a message when it has no reps.=AVERAGEIFS(I2:I13,B2:B13,">="&DATE(2026,3,1),B2:B13,"<"&DATE(2026,3,8))The average order total in the first week of March.
Paste any of these into the formula explainer to see it step by step.
Tips
- Check a surprising average with COUNTIFS on the same conditions: it tells you how many rows were averaged.
- Lock the ranges with
$and point the criteria at cells to build a summary table. - Use IFERROR around it in summary tables where some groups may be empty.
What AVERAGEIFS is used for
Average sale per region or product, average order value for one channel, average response time for high-priority tickets, and average score per class, wherever a group's mean matters more than its total.
Arguments
| Argument | Required | What it is |
|---|---|---|
| average_range | Yes | The numbers to average, such as July C2:C9. In AVERAGEIFS it always comes first. |
| criteria_range1 | Yes | The first range to test, such as Region B2:B9.Watch out: It must be the same size and shape as average_range. |
| criteria1 | Yes | Its condition: "East", ">10000", a cell, or a wildcard. |
| criteria_range2, criteria2, ... | No | More pairs, up to 127 in all; a row is averaged only when all of them match. |
Common mistakes
Putting the average range last, like SUMIF's sum range.
No row matching the conditions: Microsoft documents #DIV/0! for AVERAGEIFS then. Wrap it in IFERROR with a message such as "No data".
Averaging the averages: the mean of each region's AVERAGEIFS isn't the team average when regions have different numbers of reps.
In Google Sheets
Google Sheets' AVERAGEIFS takes the same arguments in the same order, average range first.
Errors you may see with AVERAGEIFS
Questions
Why does AVERAGEIFS return #DIV/0!?
No row matched every condition: often a typo or a stray space in the criteria, or a date condition that's out of range. Check each condition with COUNTIFS using the same pairs; 0 means nothing matched.
How do I average between two dates?
Test the date column twice: =AVERAGEIFS(I2:I13,B2:B13,">="&DATE(2026,3,1),B2:B13,"<"&DATE(2026,3,8)) averages the first week of March.
How do I average while leaving out zeros?
Use the average range as its own criteria range: =AVERAGEIFS(C2:C9,C2:C9,"<>0").
What's the difference between AVERAGEIF and AVERAGEIFS?
AVERAGEIF takes one condition with the average range last (and optional); AVERAGEIFS takes one or more with the average range first, the same order as SUMIFS.
Sources
Official documentation the facts on this page were checked against.