Excel functions · Conditional math
AVERAGEIFS function in Excel
AVERAGEIFS returns the average of the numbers in a range for the rows that meet every condition you give it, such as the average laptop order or the average order in the East. It takes the range to average first, then pairs of criteria ranges and criteria.
Last reviewed
Syntax
=AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)- average_rangerequired
- The cells to average.
- criteria_range1required
- The cells to test. Same size as average_range.
- criteria1required
- The condition, such as "Laptop" or ">100".
- criteria_range2, criteria2, ...optional
- More pairs, up to 127. A row is included only when it meets all of them.
- Criteria are text: "South", ">=1000", "<>North", or ">"&G1 to compare with a cell. * and ? work as wildcards, and matching ignores case.
- Empty cells and text in average_range are ignored.
Which versions have AVERAGEIFS
Every current Excel version: Microsoft 365, Excel for the web, Excel 2024, 2021, 2019 and 2016, on Windows and Mac.
| Version | Has it |
|---|---|
| Microsoft 365 (Windows and Mac) | Yes |
| Excel for the web | Yes |
| Excel 2024 | Yes |
| Excel 2021 | Yes |
| Excel 2019 | Yes |
| Excel 2016 | Yes |
Google Sheets
Google Sheets has AVERAGEIFS with the same arguments.
Examples
The examples use this sample sheet.
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Order ID | Rep | Region | Product | Amount |
| 2 | 1001 | Ana | North | Laptop | 1200 |
| 3 | 1002 | Ben | South | Monitor | 300 |
| 4 | 1003 | Ana | North | Monitor | 350 |
| 5 | 1004 | Cara | East | Laptop | 1150 |
| 6 | 1005 | Ben | South | Laptop | 1250 |
| 7 | 1006 | Dev | West | Keyboard | 80 |
| 8 | 1007 | Cara | East | Monitor | 320 |
| 9 | 1008 | Ana | South | Keyboard | 90 |
1.Average for one product
=AVERAGEIFS(E2:E9, D2:D9, "Laptop")Result: 1200
(1,200 + 1,150 + 1,250) / 3.
2.Average for one region
=AVERAGEIFS(E2:E9, C2:C9, "East")Result: 735
(1,150 + 320) / 2.
3.Two conditions
=AVERAGEIFS(E2:E9, B2:B9, "Ana", E2:E9, ">100")Result: 775
Ana's orders over 100 are 1,200 and 350; the 90 order is left out.
Common errors and fixes
| Error | Why it happens | Fix |
|---|---|---|
| #DIV/0! | No row meets all the conditions, so there's nothing to average. =AVERAGEIFS(E2:E9, C2:C9, "Central") returns it. | Wrap it: =IFERROR(AVERAGEIFS(...), 0) or show a message instead. |
| #VALUE! | The ranges are different sizes. | Make every range cover the same rows. |
Do it with GPTExcel
Skip writing AVERAGEIFS by hand
Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.
Show the average order value by rep and region, and highlight the lowest.
Done. I used AVERAGEIFS on your sheet and checked the results against your data.
- Written for your platform and version
- Checked against your actual data
- Newest functions looked up in official docs
AVERAGEIFS questions
- Why does AVERAGEIFS return #DIV/0!?
- Because no row meets every condition, so Excel would divide by zero. Check the criteria for typos and extra spaces, or wrap the formula in IFERROR.
- Does AVERAGEIFS count blank cells as zero?
- No. Blank cells and text in average_range are skipped, so they don't pull the average down.
Skip the formula hunt
Upload a spreadsheet and ask in plain English. Free plan, no credit card.
Start free