
The Excel AVERAGEIF function calculates the average of numbers that match one condition. It is useful for finding the average sales value for one department, average marks above a threshold, or average order size for a specific product.
AVERAGEIF syntax
=AVERAGEIF(range, criteria, [average_range])
range contains cells tested against the condition. criteria is the rule. The optional average_range contains the numeric values to average. When omitted, Excel averages the qualifying numeric cells in range itself.
Example 1: Average sales by department
Imagine A2:A6 contains Sales, HR, Sales, IT, Sales, while B2:B6 contains 600, 300, 900, 500 and 1,200 respectively.
=AVERAGEIF(A2:A6,"Sales",B2:B6)
Result: 900. Only the three Sales rows are averaged: (600 + 900 + 1,200) / 3.
Example 2: Average numbers above a threshold
If C2:C6 contains 40, 60, 80, 20 and 100:
=AVERAGEIF(C2:C6,">50")
Result: 80. The qualifying scores are 60, 80 and 100.
Example 3: Use a changing condition
Put the department name in E2 and use:
=AVERAGEIF(A2:A6,E2,B2:B6)
You can now change E2 from Sales to HR without rewriting the formula. For numeric comparisons against a value in E2, use =AVERAGEIF(C2:C6,">"&E2).
Example 4: Average items matching partial text
To average values in B2:B20 where product names in A2:A20 start with Laptop:
=AVERAGEIF(A2:A20,"Laptop*",B2:B20)
An asterisk matches any sequence of characters. A question mark matches exactly one character.
Example 5: Average nonzero values
To exclude zero sales from an average, use:
=AVERAGEIF(B2:B20,"<>0")
This is different from =AVERAGE(B2:B20), because AVERAGE includes zero values while ignoring blanks and text.
Example 6: Average values within a date-based subset
If A2:A100 contains genuine Excel dates and B2:B100 contains order values, you can average orders on or after 1 July 2026:
=AVERAGEIF(A2:A100,">="&DATE(2026,7,1),B2:B100)
To set both a start and end date, switch to AVERAGEIFS with two date criteria.
AVERAGEIF vs AVERAGEIFS
AVERAGEIF checks one condition. AVERAGEIFS averages a numeric range based on multiple conditions, such as department = Sales and region = West. Note that their argument order differs: AVERAGEIFS places the average range first.
Common AVERAGEIF errors
- #DIV/0!: no matching numeric cells were available to average. Confirm criteria and the source data before using IFERROR.
- Mismatched range sizes: use equally sized criteria and average ranges to avoid shifted or confusing results.
- Text numbers: cells that look numeric may actually be stored as text.
- Extra spaces: “Sales ” can differ from “Sales”. Clean inconsistent labels.
- Wrong criterion syntax: comparisons require quotation marks such as
">50".
Frequently asked questions
Does AVERAGEIF include blank cells?
Blank cells and text values in the average range are ignored when calculating the average. Zero values are included unless the criteria exclude them.
Can I average using two conditions?
Yes, use AVERAGEIFS rather than stacking unrelated AVERAGEIF formulas.
Is AVERAGEIF case-sensitive?
No. Its text comparisons are normally case-insensitive.
Practice exercise
Build a worksheet with departments and monthly salaries. Calculate the average salary for HR, the average salary above ₹30,000, and the average for a department typed into a separate input cell.
Continue with Module 3: Excel Functions to practice additional formulas.
