ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Conditional math
  3. AVERAGEIF and AVERAGEIFS in Excel

AVERAGEIF and AVERAGEIFS in Excel

By ExcelReady Team·Updated October 30, 2026·7 min read

The short answer

AVERAGEIF averages the numbers in rows that meet one condition: =AVERAGEIF(range, criteria, average_range), for example =AVERAGEIF(B2:B9,"Marketing",D2:D9). AVERAGEIFS handles two or more conditions and puts the numbers to average first: =AVERAGEIFS(D2:D9,B2:B9,"Finance",C2:C9,"Senior"). If no row matches, both return the #DIV/0! error, so check your criteria or wrap the formula in IFERROR.

Key takeaways

  • AVERAGEIF has the SUMIF shape: range, criteria, then average_range.
  • AVERAGEIFS has the SUMIFS shape: the numbers to average come first, then range/criteria pairs.
  • If no row matches, the result is #DIV/0!. Wrap the formula in IFERROR to show a message instead.
  • Empty cells and text in the average range are skipped, but zeros are counted.
On this page+
  1. What does AVERAGEIF do in Excel?
  2. How to use AVERAGEIF: step by step
  3. AVERAGEIF with numbers and comparisons
  4. How to use AVERAGEIFS for multiple conditions
  5. How to build a department summary with AVERAGEIF
  6. Why does AVERAGEIF return #DIV/0!?
  7. Related conditional functions
  8. Practise it

Excel AVERAGEIF gives you the average of only the rows that meet a condition, such as the average salary in one department. AVERAGEIFS does the same with two or more conditions. If you already know SUMIF and SUMIFS, you know the shapes: this guide shows both on one staff table, plus how to handle the #DIV/0! error you get when nothing matches.

What does AVERAGEIF do in Excel?#

AVERAGEIF checks each row against one condition, then averages the numbers from the rows that match. The syntax:

Excel formula
=AVERAGEIF(range, criteria, [average_range])
PartWhat it meansExample
rangeThe cells to checkB2:B9 (Department)
criteriaWhat they must match"Engineering", ">=5"
average_rangeThe numbers to average (optional)D2:D9 (Salary)

If you leave out average_range, AVERAGEIF averages the cells it checked. AVERAGEIF and AVERAGEIFS have been in Excel since Excel 2007.

The examples use this staff table in A1:E9:

ABCDE
1EmployeeDepartmentLevelSalaryYears
2NoorFinanceSenior920008
3FelixEngineeringJunior680001
4IvyEngineeringSenior1180009
5KenjiFinanceJunior580002
6LaraMarketingSenior840007
7MiloEngineeringMid950004
8NiaMarketingJunior520001
9OscarFinanceMid740005

How to use AVERAGEIF: step by step#

Give AVERAGEIF the column to check, the value to match, and the column to average. For the average Engineering salary:

  1. Click an empty cell, such as H2.
  2. Type =AVERAGEIF( and select B2:B9.
  3. Type ,"Engineering", and select D2:D9.
  4. Close the bracket and press Enter.
Excel formula
=AVERAGEIF(B2:B9,"Engineering",D2:D9)

The result is 93,666.67: (68,000 + 118,000 + 95,000) ÷ 3. To show a whole number, wrap it in ROUND: =ROUND(AVERAGEIF(B2:B9,"Engineering",D2:D9),0) gives 93,667.

How to check an AVERAGEIF result#

AVERAGEIF is the same as a SUMIF divided by a COUNTIF with the same criteria. You can prove a result this way:

Excel formula
=SUMIF(B2:B9,"Marketing",D2:D9)/COUNTIF(B2:B9,"Marketing")

This gives 136,000 ÷ 2 = 68,000, the same as =AVERAGEIF(B2:B9,"Marketing",D2:D9). If the two ever differ, one of the ranges doesn't line up. It's also a handy way to explain your answer in a job test.

For comparison, the plain average of every salary is =AVERAGE(D2:D9), which gives 80,125. The AVERAGE function guide covers the basics.

AVERAGEIF with numbers and comparisons#

Comparisons go in double quotes, just as in COUNTIF and SUMIF. To average the salaries of everyone with 5 or more years:

Excel formula
=AVERAGEIF(E2:E9,">=5",D2:D9)

Four people match (Noor, Ivy, Lara and Oscar), so the result is 92,000. Oscar has exactly 5 years, so ">5" would leave him out and give 98,000 instead.

QuestionFormulaResult
Average Marketing salary=AVERAGEIF(B2:B9,"Marketing",D2:D9)68,000
Average for 5+ years=AVERAGEIF(E2:E9,">=5",D2:D9)92,000
Average of everyone not Junior=AVERAGEIF(C2:C9,"<>Junior",D2:D9)92,600
Average of salaries above 80,000=AVERAGEIF(D2:D9,">80000")97,250

The last row has no average_range, so AVERAGEIF averages the salaries it checked: 92,000, 118,000, 84,000 and 95,000.

How to use AVERAGEIFS for multiple conditions#

AVERAGEIFS puts the numbers to average first, then one range/criteria pair per condition. To average Senior salaries in Finance:

Excel formula
=AVERAGEIFS(D2:D9,B2:B9,"Finance",C2:C9,"Senior")

Only Noor matches, so the result is 92,000. Here's another with a comparison, the average Engineering salary for people with 4 or more years:

Excel formula
=AVERAGEIFS(D2:D9,B2:B9,"Engineering",E2:E9,">=4")

Ivy and Milo match: (118,000 + 95,000) ÷ 2 = 106,500.

The order switch catches many people out. AVERAGEIF puts the average range last; AVERAGEIFS puts it first. It's the same rule as SUMIF and SUMIFS with multiple conditions.

How to build a department summary with AVERAGEIF#

Point the criteria at a cell, lock the ranges, and fill down. Put Finance, Marketing and Engineering in G8:G10, then type this in H8:

Excel formula
=AVERAGEIF($B$2:$B$9,G8,$D$2:$D$9)

Select H8:H10 and fill down (Windows: Ctrl+D; Mac: ⌘D). You get 74,666.67 for Finance, 68,000 for Marketing and 93,666.67 for Engineering. The $ signs keep the data ranges fixed; G8 moves to G9 and G10.

Who is paid above their department average?#

You can also use each row's own department as the criteria. In F2, type this and fill down to F9:

Excel formula
=D2>AVERAGEIF($B$2:$B$9,B2,$D$2:$D$9)

For each person, AVERAGEIF works out the average of their department, and the > comparison returns TRUE or FALSE. Noor shows TRUE (92,000 is above the Finance average of 74,666.67), and Kenji shows FALSE. This kind of "compare to the group" column is a common task in HR and sales reports.

Why does AVERAGEIF return #DIV/0!?#

AVERAGEIF returns #DIV/0! when no row matches, because an average of nothing means dividing by zero. For example, =AVERAGEIF(B2:B9,"Sales",D2:D9) fails because there's no Sales department.

First check that the criteria really should match: look for typos, extra spaces, or the ranges in the wrong order. If an empty result is normal, show a message instead:

Excel formula
=IFERROR(AVERAGEIF(B2:B9,"Sales",D2:D9),"No staff")

Other things to know:

  • Blanks and text are skipped in the average range, so a missing salary doesn't count as zero.
  • Zeros are counted. To exclude them, add a pair such as D2:D9,"<>0" in AVERAGEIFS.
  • Same-size ranges. Make range and average_range cover the same rows, like B2:B9 and D2:D9.

Related conditional functions#

Averages are one of several "IF" summaries that share the same criteria rules. MAXIFS and MINIFS find the highest and lowest values for a group. Wildcards like * and ? let you average rows whose text only partly matches. To average or total between two dates, see sum by date range with SUMIFS; the same date criteria work in AVERAGEIFS. If your data has a few very large values, a median may describe it better; average vs median explains when.

Practise it#

Practise AVERAGEIF, AVERAGEIFS, MAXIFS and MINIFS in a live spreadsheet. You'll average salaries by department and years, combine two conditions, and fill a cell-based summary down a table, with feedback on every step.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

What is the average salary in Marketing? Click H2 and use AVERAGEIF: check the Department column (B2:B9) and average the Salary column (D2:D9).

fx
ABCDEFGHI
1
Employee
Department
Level
Salary
Years
2
Noor
Finance
Senior
92000
8
Avg Marketing salary
3
Felix
Engineering
Junior
68000
1
4
Ivy
Engineering
Senior
118000
9
5
Kenji
Finance
Junior
58000
2
6
Lara
Marketing
Senior
84000
7
7
Milo
Engineering
Mid
95000
4
8
Nia
Marketing
Junior
52000
1
9
Oscar
Finance
Mid
74000
5
10
11
12

Tip: Same order as SUMIF: the range to check, the word in quotes, then the numbers to average.

Practise this in a lesson

LessonAVERAGEIF, MAXIFS and MINIFSFind the average, highest and lowest values that meet one or more conditions.Function guideAVERAGECalculate the mean in Excel with AVERAGE. See how it treats blanks and zeros, avoid common errors, and practice in a live sheet.

Frequently asked questions

What is the difference between AVERAGEIF and AVERAGEIFS?

+

AVERAGEIF takes one condition and puts the average range last. AVERAGEIFS takes one or more conditions and puts the average range first, like SUMIFS.

Why does AVERAGEIF return #DIV/0!?

+

No row matched the criteria, so Excel tried to divide by zero. Check the spelling and spaces in the criteria, or wrap the formula: =IFERROR(AVERAGEIF(...),"No data").

Does AVERAGEIF ignore zeros?

+

No. Zeros are numbers, so they count toward the average. To leave them out, add a condition: =AVERAGEIFS(D2:D9,B2:B9,"Sales",D2:D9,"<>0").

Does AVERAGEIF ignore blank cells?

+

Yes. Empty cells and text in the average range are skipped, so they don't pull the average down.

Can AVERAGEIF use a cell as the criteria?

+

Yes. =AVERAGEIF($B$2:$B$9,G8,$D$2:$D$9) averages the rows whose department matches the name in G8, and it can be filled down.

Sources

  • AVERAGEIF function - Microsoft Support
  • AVERAGEIFS function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What does AVERAGEIF do in Excel?
  2. How to use AVERAGEIF: step by step
  3. AVERAGEIF with numbers and comparisons
  4. How to use AVERAGEIFS for multiple conditions
  5. How to build a department summary with AVERAGEIF
  6. Why does AVERAGEIF return #DIV/0!?
  7. Related conditional functions
  8. Practise it

Keep reading

Conditional math· 7 min read

MAXIFS and MINIFS: Highest and Lowest With Conditions

MAXIFS returns the highest number among the rows that meet one or more conditions, and MINIFS returns the lowest. Both put the numbers first, then range/criteria pairs: =MAXIFS(D2:D9,B2:B9,"Marketing") finds the top Marketing salary. They need Excel 2019 or newer. If nothing matches, they return 0, not an error.

Conditional math· 7 min read

Excel Wildcards: *, ? and ~ in COUNTIF and SUMIF

Excel has three wildcard characters for criteria. An asterisk (*) matches any number of characters, so "CAB-*" means starts with CAB-. A question mark (?) matches exactly one character. A tilde (~) before * or ? makes it a normal character. Use them inside quotes in COUNTIF, SUMIF, COUNTIFS and SUMIFS, for example =COUNTIF(A2:A9,"CAB-*").

Conditional math· 7 min read

Sum by Date Range or Month in Excel With SUMIFS

To sum between two dates, give SUMIFS the same date column twice: once with ">="&start and once with "<"&end. For January 2025, write =SUMIFS(D2:D9,A2:A9,">="&DATE(2025,1,1),A2:A9,"<"&DATE(2025,2,1)). Keep the operator in quotes and join the date with &. Using "before the 1st of next month" works for every month.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free