Skip to content

AVERAGEIFS

Averages the numbers in a range that meet two or more conditions at once, such as one region in one quarter.

Syntax

=AVERAGEIFS(, , , [criteria_range2, criteria2], ...)

Statistical

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

Try it

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

D10
A
B
C
D
1
Region
Quarter
Rep
Order value
2
East
Q1
Ines
1,200
3
West
Q1
Tom
950
4
East
Q2
Priya
1,400
5
East
Q1
Priya
1,000
6
West
Q2
Tom
1,100
7
East
Q1
Ines
800
8
West
Q1
Ines
1,250
9
10
East, Q1 average
1,000
11
12

D10 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1") returns 1,000

How AVERAGEIFS works

AVERAGEIFS averages the numbers in one column, but only for rows that satisfy every condition you set. It answers questions such as "average order value for East in Q1" or "average delay for suppliers rated A that shipped by air".

Argument order

The average range comes first, then pairs of criteria range and condition:

=AVERAGEIFS(D2:D13, A2:A13, "East", B2:B13, "Q1")

Every criteria range must be exactly the same size and shape as average_range. If one is shorter, the formula returns #VALUE!. Absolute references, such as $D$2:$D$13, keep the ranges steady when you copy the formula.

AND logic only

All conditions must be true for a row to count. That is "East and Q1". There is no built-in OR. To average East or West, add the two groups together with their counts, or use AVERAGE with FILTER in Microsoft 365: =AVERAGE(FILTER(D2:D13,(A2:A13="East")+(A2:A13="West")>0)).

Conditions on dates and numbers

Combine an operator with a cell using &. To average rows between two dates held in cells, use two conditions on the same range:

=AVERAGEIFS(D2:D13, B2:B13, ">="&F1, B2:B13, "<="&F2)

Wildcards work with text conditions: "N*" for anything starting with N, "*air*" for anything containing "air". Use ~* to look for a real asterisk.

Blanks, text and errors

Cells in average_range that are empty or text are skipped. If no row meets all the conditions, AVERAGEIFS returns #DIV/0!, so wrap it in IFERROR for a friendlier result. An error value inside average_range makes the result an error.

AVERAGEIFS versus AVERAGEIF

AVERAGEIF takes one condition and puts average_range last. AVERAGEIFS takes any number of conditions and puts it first. You can use AVERAGEIFS for a single condition too, and many analysts do, so the formula can grow later without being rewritten.

To average with no conditions, use AVERAGE. To find the largest or smallest value under the same kind of conditions, see MAXIFS and MINIFS.

Arguments

average_range
The cells to average, such as D2:D13. Unlike AVERAGEIF, it comes first.
criteria_range1
The first range to test, such as A2:A13. It must be the same size and shape as average_range.
criteria1
The first condition: a value, a cell reference or an expression such as ">=100", "<>East" or "N*". Text and operators go in quotes.
criteria_range2, criteria2, ...optional
More pairs of range and condition, up to 127 pairs. A row is averaged only when it passes every condition.

Examples

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

Example 1

Two conditions: region and quarter

D10 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1")

Result: 1,000

Three rows are East and Q1: 1,200, 1,000 and 800. They average 1,000.

D10
A
B
C
D
1
Region
Quarter
Rep
Order value
2
East
Q1
Ines
1,200
3
West
Q1
Tom
950
4
East
Q2
Priya
1,400
5
East
Q1
Priya
1,000
6
West
Q2
Tom
1,100
7
East
Q1
Ines
800
8
West
Q1
Ines
1,250
9
10
East, Q1 average
1,000
11
12

D10 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1") returns 1,000

Example 2

Conditions taken from cells

C11 =AVERAGEIFS(D2:D8,A2:A8,A11,B2:B8,B11)

Result: 1,100

Change A11 or B11 and the average follows. West in Q2 has one order, 1,100.

C11
A
B
C
D
1
Region
Quarter
Rep
Order value
2
East
Q1
Ines
1,200
3
West
Q1
Tom
950
4
East
Q2
Priya
1,400
5
East
Q1
Priya
1,000
6
West
Q2
Tom
1,100
7
East
Q1
Ines
800
8
West
Q1
Ines
1,250
9
10
Region
Quarter
Average
11
West
Q2
1,100
12

C11 =AVERAGEIFS(D2:D8,A2:A8,A11,B2:B8,B11) returns 1,100

Example 3

A numeric condition plus a text condition

D10 =AVERAGEIFS(D2:D8,A2:A8,"East",D2:D8,">=1000")

Result: 1,200

The average range can also be one of the criteria ranges. East orders of 1,000 or more are 1,200, 1,400 and 1,000, which average 1,200.

D10
A
B
C
D
1
Region
Quarter
Rep
Order value
2
East
Q1
Ines
1,200
3
West
Q1
Tom
950
4
East
Q2
Priya
1,400
5
East
Q1
Priya
1,000
6
West
Q2
Tom
1,100
7
East
Q1
Ines
800
8
West
Q1
Ines
1,250
9
10
East orders of 1,000+
1,200
11
12

D10 =AVERAGEIFS(D2:D8,A2:A8,"East",D2:D8,">=1000") returns 1,200

Example 4

Exclude one group and handle no matches

D10 =IFERROR(AVERAGEIFS(D2:D8,A2:A8,"West",B2:B8,"Q3"),"No orders")

Result: No orders

No row is West and Q3, so AVERAGEIFS alone would return #DIV/0!.

D10
A
B
C
D
1
Region
Quarter
Rep
Order value
2
East
Q1
Ines
1,200
3
West
Q1
Tom
950
4
East
Q2
Priya
1,400
5
East
Q1
Priya
1,000
6
West
Q2
Tom
1,100
7
East
Q1
Ines
800
8
West
Q1
Ines
1,250
9
10
West, Q3 average
No orders
11
12

D10 =IFERROR(AVERAGEIFS(D2:D8,A2:A8,"West",B2:B8,"Q3"),"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 F2, return the average delay for sea shipments from suppliers whose grade is in E2.

Answer in F2.

F2
A
B
C
D
E
F
1
Supplier grade
Mode
Delay (days)
Grade
Average delay
2
A
Air
2
A
3
B
Sea
9
4
A
Sea
6
Sea, any grade
5
A
Air
4
6
C
Sea
12
7
B
Air
3
8
A
Sea
8
9
B
Sea
7
10

Common mistakes

  • #VALUE! means a criteria range is a different size from average_range. Make every range start and end on the same rows.
  • #DIV/0! means no row met all the conditions. Check spelling, extra spaces and whether numbers in the data are really text.
  • The argument order is not the same as AVERAGEIF. Here average_range comes first, and each condition is a pair of range and criteria.
  • All conditions are joined with AND. You can't ask for "East or West" with one AVERAGEIFS; use two formulas, or AVERAGE with FILTER.
  • Typing the cell reference inside quotes, such as "A11", searches for the text A11. Leave the quotes off, or join with &, for example ">="&F1.

Questions people ask

Can AVERAGEIFS use OR logic?

Not directly. Each extra condition narrows the result. For East or West, calculate two averages, or use `=AVERAGE(FILTER(D2:D13,(A2:A13="East")+(A2:A13="West")>0))` in Microsoft 365.

How do I average between two dates?

Use two conditions on the date column: `=AVERAGEIFS(D2:D13,B2:B13,">="&F1,B2:B13,"<="&F2)`, where F1 and F2 hold the start and end dates.

Why does AVERAGEIFS return #DIV/0!?

No row met every condition. Check the spelling, trailing spaces and data types, or wrap the formula in IFERROR to show a message.

Does AVERAGEIFS work with one condition?

Yes. `=AVERAGEIFS(D2:D13,A2:A13,"East")` gives the same answer as AVERAGEIF, with the average range first.

How many conditions can AVERAGEIFS take?

Up to 127 pairs of criteria range and criteria.

Learn AVERAGEIFS in a real sheet.

AVERAGEIFS is taught in Data analysis with formulas, lesson 2: COUNTIFS and AVERAGEIFS. Each lesson is a short, graded exercise like the one above.