Skip to content

AVERAGEIF

Averages the numbers in a range that meet one condition, such as the average order value for one region.

Syntax

=AVERAGEIF(, , )

Statistical

Excel 2007 and later, including Excel for Microsoft 365 and Excel for the web.

Try it

Edit the formula in C11 or change the inputs. The sheet recalculates as you type.

C11
A
B
C
1
Region
Rep
Order value
2
East
Ines
1,200
3
West
Tom
950
4
East
Priya
1,400
5
North
Ines
800
6
West
Tom
1,100
7
East
Priya
1,000
8
North
Tom
700
9
West
Ines
1,250
10
11
East average
1,200

C11 =AVERAGEIF(A2:A9,"East",C2:C9) returns 1,200

How AVERAGEIF works

AVERAGEIF works out the average of only those numbers that pass a test. Use it for "average order value for the East region", "average score above 60", or "average of everything except returns".

How the arguments fit together

AVERAGEIF checks each cell in range against criteria. For every cell that passes, it takes the number in the same position of average_range and adds it to the average. If you leave out average_range, AVERAGEIF averages the cells in range itself, which suits conditions on the numbers, such as =AVERAGEIF(C2:C9,">=1000").

The criteria can be:

  • A value, such as "East" or 50, which must match the whole cell. Matching ignores upper and lower case.
  • A comparison, such as ">100", "<=20" or "<>East". The operator and number go together inside one set of quotes.
  • A wildcard pattern, such as "N*" for anything starting with N.
  • A cell reference, such as E2. This is the best option when the condition changes, because you can type a new region into E2 and the average follows. To combine an operator with a cell, join them: ">"&E2.

What gets skipped

Cells in average_range that are blank, or hold text, are ignored. If a cell in range matches but the matching cell in average_range is empty, that row is left out, not counted as zero. If no cell matches at all, AVERAGEIF returns #DIV/0!. Wrap it in IFERROR when "no matching rows" is a normal outcome:

=IFERROR(AVERAGEIF(A2:A9,"South",C2:C9),"No orders")

One condition or several

AVERAGEIF takes a single condition. For two or more, such as East region and orders over 1000, use AVERAGEIFS. Note that the argument order differs: in AVERAGEIF the average_range comes last, and in AVERAGEIFS it comes first.

Alternatives

Without a condition, use AVERAGE. To average visible rows after filtering, use SUBTOTAL or AGGREGATE. In Microsoft 365 you can also combine FILTER with AVERAGE, which is handy when the condition is complicated: =AVERAGE(FILTER(C2:C9,A2:A9="East")).

Arguments

range
The cells to test against the condition, such as A2:A9. If you leave out average_range, these are also the cells that get averaged.
criteria
The condition: a number, text, a cell reference or an expression such as ">=1000", "<>East" or "W*". Text and operators go in quotes. * matches any run of characters and ? matches one character.
average_rangeoptional
The cells to average, such as C2:C9. It is matched to range by position, starting from its top-left cell, so give it the same shape as range.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Average for one region

C11 =AVERAGEIF(A2:A9,"East",C2:C9)

Result: 1,200

Three East orders (1,200, 1,400 and 1,000) add up to 3,600. Divided by 3 gives 1,200.

C11
A
B
C
1
Region
Rep
Order value
2
East
Ines
1,200
3
West
Tom
950
4
East
Priya
1,400
5
North
Ines
800
6
West
Tom
1,100
7
East
Priya
1,000
8
North
Tom
700
9
West
Ines
1,250
10
11
East average
1,200

C11 =AVERAGEIF(A2:A9,"East",C2:C9) returns 1,200

Example 2

Average of the values that pass a test

C11 =AVERAGEIF(C2:C9,">=1000")

Result: 1,190

With no average_range, AVERAGEIF averages the cells it tests. Five orders are 1,000 or more: 1,200, 1,400, 1,100, 1,000 and 1,250, which average 1,190.

C11
A
B
C
1
Region
Rep
Order value
2
East
Ines
1,200
3
West
Tom
950
4
East
Priya
1,400
5
North
Ines
800
6
West
Tom
1,100
7
East
Priya
1,000
8
North
Tom
700
9
West
Ines
1,250
10
11
Average of 1,000+
1,190

C11 =AVERAGEIF(C2:C9,">=1000") returns 1,190

Example 3

Wildcard criteria

C11 =AVERAGEIF(A2:A9,"W*",C2:C9)

Result: 1,100

"W*" matches West. Its orders (950, 1,100 and 1,250) average 1,100.

C11
A
B
C
1
Region
Rep
Order value
2
East
Ines
1,200
3
West
Tom
950
4
East
Priya
1,400
5
North
Ines
800
6
West
Tom
1,100
7
East
Priya
1,000
8
North
Tom
700
9
West
Ines
1,250
10
11
Regions starting with W
1,100

C11 =AVERAGEIF(A2:A9,"W*",C2:C9) returns 1,100

Example 4

Handle a condition that matches nothing

C11 =IFERROR(AVERAGEIF(A2:A9,"South",C2:C9),"No orders")

Result: No orders

There is no South row, so AVERAGEIF alone returns #DIV/0!. IFERROR turns that into a readable message.

C11
A
B
C
1
Region
Rep
Order value
2
East
Ines
1,200
3
West
Tom
950
4
East
Priya
1,400
5
North
Ines
800
6
West
Tom
1,100
7
East
Priya
1,000
8
North
Tom
700
9
West
Ines
1,250
10
11
South average
No orders

C11 =IFERROR(AVERAGEIF(A2:A9,"South",C2:C9),"No orders") returns No orders

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In E2, return the average order value for the channel named in D2.

Answer in E2.

E2
A
B
C
D
E
1
Channel
Order value
Channel
Average order
2
Web
120
Web
3
Phone
85
4
Web
95
Over 100
5
Store
150
6
Phone
110
7
Web
130
8
Store
70
9
Phone
60

Common mistakes

  • #DIV/0! means no cell met the condition. Check the spelling of the criteria and look for stray spaces in the data. Use IFERROR if "no matches" is expected.
  • Putting a cell reference inside quotes, such as "E2", searches for the literal text E2. Write E2 without quotes, or ">"&E2 to combine it with an operator.
  • The argument order is range, criteria, average_range. AVERAGEIFS puts the average range first, so formulas copied between the two functions break quietly or return #VALUE!.
  • Matching rows whose average_range cell is empty or text are skipped rather than counted as zero, so the average can be based on fewer rows than the criteria matched.
  • A criterion such as ">100" compares numbers only. Numbers stored as text in range are not matched by a numeric comparison.

Questions people ask

What is the difference between AVERAGEIF and AVERAGEIFS?

AVERAGEIF takes one condition and puts average_range last. AVERAGEIFS takes one or more conditions and puts average_range first. AVERAGEIFS also works with a single condition.

How do I average cells that are not equal to a value?

Use the not-equal operator inside quotes: `=AVERAGEIF(A2:A9,"<>East",C2:C9)` averages every row except East.

Can AVERAGEIF use a cell as the criteria?

Yes. `=AVERAGEIF(A2:A9,E2,C2:C9)` uses whatever is in E2. To compare with an operator, join it to the cell: `=AVERAGEIF(C2:C9,">"&E2)`.

Why does AVERAGEIF return #DIV/0!?

No cell in the range met the condition, so there was nothing to average. Check for typos and extra spaces, or wrap the formula in IFERROR.

Is AVERAGEIF case-sensitive?

No. `"east"` matches `East` and `EAST`.

Learn AVERAGEIF in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.