Excel AVERAGEIF Function: Average Only What Matters

Learn how to use Excel's AVERAGEIF to average numbers that meet a condition. Step-by-step examples, common errors, and practical tips for real work.

AVERAGEIF function — SheetSkill guide
In short

AVERAGEIF returns the average (arithmetic mean) of cells in a range that meet a specified condition. It lets you average only the values that match your criteria, such as a region, a product, or a minimum score.

=AVERAGEIF(range, criteria, [average_range])

What does AVERAGEIF do?

AVERAGEIF is a statistical function that calculates the average of numbers in a range only when they meet a condition you set. Instead of averaging everything, you tell Excel which rows to include, and it ignores the rest. The result is a single number that reflects just the subset you care about.

This matters because most real data mixes categories, dates, and amounts. You often need the average sales for one region, the average score for one class, or the average price for one product. AVERAGEIF answers those questions in one formula, without sorting or filtering your table.

Imagine you manage a small sales team and your manager asks for the average order value from the North region last quarter. Your sheet has hundreds of rows across four regions. With AVERAGEIF you point at the Region column, specify North, and point at the Order Value column. The answer appears instantly and updates if the data changes.

When to use AVERAGEIF

  • Average sales for a specific region, product, or salesperson.
  • Average test scores for students in one class or above a threshold.
  • Average order value for a single customer or date range.
  • Average delivery time for one carrier or warehouse.
  • Average expense amount for a department or category.
  • Average ratings for products with a minimum number of reviews.

AVERAGEIF syntax

=AVERAGEIF(range, criteria, [average_range])
ArgumentRequired?What to enter
rangeRequiredThe range of cells to check against the criteria. It can contain numbers, text, dates, or logical values. Example: B2:B10.
criteriaRequiredThe condition that decides which cells to average. It can be a number, text, cell reference, or expression. Text and operators must be in quotes. Example: "North" or ">100".
average_rangeOptionalThe actual cells to average. If omitted, Excel averages the cells in range. Example: C2:C10.

What it returns: A number: the arithmetic mean of the cells in average_range that correspond to rows where range meets the criteria. If no cells meet the criteria, AVERAGEIF returns the #DIV/0! error.

AVERAGEIF examples

1 Average sales for one region

The goal is to find the average sales amount for the North region. The formula checks each cell in A2:A6 for the text North, then averages the matching values in B2:B6. Only the three North rows (1200, 1500, 1800) are included, and their sum is 4500. Dividing by 3 gives 1500.

D2=AVERAGEIF(A2:A6,"North",B2:B6)
ABCDE
1RegionSales
2North12001500
3South900
4North1500
5East1100
6North1800
7
The formula in D2 returns 1500.

2 Average scores above a threshold

Here you want the average of scores that are greater than 70. The criteria ">70" is applied to the Score column itself, so the third argument is omitted. The formula averages only the values 85, 90, and 78. Their sum is 253, and dividing by 3 gives approximately 84.33.

D2=AVERAGEIF(B2:B6,">70")
ABCDE
1StudentScore
2Ana8584.33333333
3Ben62
4Cara90
5Dan55
6Eve78
7
The formula in D2 returns 84.33333333.

3 Average order value for a specific customer

You need the average order amount for customer C-102. The formula looks through A2:A7 for the exact text C-102 and averages the corresponding amounts in C2:C7. The matching orders are 250, 300, and 200, which total 750. Divided by 3, the average is 250.

E2=AVERAGEIF(A2:A7,"C-102",C2:C7)
ABCDEF
1CustomerOrder DateAmount
2C-1012024-01-05180250
3C-1022024-01-07250
4C-1032024-01-08320
5C-1022024-01-10300
6C-1012024-01-12210
7C-1022024-01-15200
8
The formula in E2 returns 250.

4 Average delivery time for one carrier

The goal is the average delivery days for carrier FastShip. The formula checks B2:B7 for FastShip and averages the matching days in D2:D7. The FastShip deliveries took 3, 4, and 2 days, totaling 9. The average is 3 days.

F2=AVERAGEIF(B2:B7,"FastShip",D2:D7)
ABCDEFG
1Order IDCarrierShip DateDays
21001FastShip2024-02-0133
31002SlowCo2024-02-016
41003FastShip2024-02-024
51004QuickPost2024-02-025
61005FastShip2024-02-032
71006SlowCo2024-02-037
8
The formula in F2 returns 3.

5 Average expense for a department

You want the average expense amount for the Marketing department. The formula scans B2:B8 for Marketing and averages the values in D2:D8. The Marketing expenses are 500, 750, and 600, which sum to 1850. Dividing by 3 gives approximately 616.67.

F2=AVERAGEIF(B2:B8,"Marketing",D2:D8)
ABCDEFG
1EmployeeDepartmentExpense DateAmount
2KimMarketing2024-03-01500616.6666667
3LeeSales2024-03-02400
4MiaMarketing2024-03-03750
5NoahIT2024-03-04300
6OmarMarketing2024-03-05600
7PiaSales2024-03-06450
8QuinnIT2024-03-07350
9
The formula in F2 returns 616.6666667.

Common AVERAGEIF errors and how to fix them

ErrorWhy it happensHow to fix it
#DIV/0!No cells in the range meet the criteria, so there is nothing to average.Check the spelling and format of your criteria, or wrap the formula in IFERROR to show a friendly message.
#VALUE!The average_range contains text that cannot be averaged, or the criteria is malformed.Make sure average_range contains only numbers or blanks, and put text criteria in quotes.
Wrong result (too high or too low)The range and average_range are different sizes, so Excel aligns them incorrectly.Use ranges of the same size and shape, for example both starting at row 2 and ending at row 10.
Criteria not matchingText criteria are case-insensitive but extra spaces or different data types can prevent a match.Trim spaces with TRIM or use wildcards like "*North*" for partial matches.

Tips for using AVERAGEIF

  • Use cell references for criteria, such as =AVERAGEIF(A2:A10,D1,B2:B10), so you can change the condition without editing the formula.
  • Combine operators with numbers in quotes, for example ">=100" or "North".
  • Wildcards work in text criteria: ? matches one character and * matches any sequence.
  • If average_range is omitted, AVERAGEIF averages the same cells it tests, which is handy for threshold averages.
  • Remember that AVERAGEIF ignores blank cells and text in the average range, but counts zero values.
  • For multiple conditions, use AVERAGEIFS instead of nesting AVERAGEIF.

Frequently asked questions

What is the difference between AVERAGEIF and AVERAGEIFS?

AVERAGEIF handles one condition. AVERAGEIFS lets you apply two or more conditions across different ranges.

Can AVERAGEIF use wildcards?

Yes. Use ? for a single character and * for any number of characters in text criteria, such as "North*".

Why does AVERAGEIF return #DIV/0!?

It means no cells met your criteria. Verify the criteria spelling and that the range contains matching values.

Does AVERAGEIF work with dates?

Yes. Use a date criteria in quotes, such as ">=2024-01-01", or refer to a cell that contains a date.

Related functions

Every example on this page was recalculated by SheetSkill’s spreadsheet engine. AVERAGEIF reference