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.

AVERAGEIFS availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019Yes
Excel 2016Yes

Google Sheets

Google Sheets has AVERAGEIFS with the same arguments.

Examples

The examples use this sample sheet.

Orders (A1:E9)
RowABCDE
1Order IDRepRegionProductAmount
21001AnaNorthLaptop1200
31002BenSouthMonitor300
41003AnaNorthMonitor350
51004CaraEastLaptop1150
61005BenSouthLaptop1250
71006DevWestKeyboard80
81007CaraEastMonitor320
91008AnaSouthKeyboard90
  1. 1.Average for one product

    =AVERAGEIFS(E2:E9, D2:D9, "Laptop")

    Result: 1200

    (1,200 + 1,150 + 1,250) / 3.

  2. 2.Average for one region

    =AVERAGEIFS(E2:E9, C2:C9, "East")

    Result: 735

    (1,150 + 320) / 2.

  3. 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

AVERAGEIFS errors, causes and fixes
ErrorWhy it happensFix
#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.

your-file.xlsx

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.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

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