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 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1") returns 1,000
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], ...)
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 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1") returns 1,000
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".
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.
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)).
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.
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.
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.
D2:D13. Unlike AVERAGEIF, it comes first.A2:A13. It must be the same size and shape as average_range.">=100", "<>East" or "N*". Text and operators go in quotes.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
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 =AVERAGEIFS(D2:D8,A2:A8,"East",B2:B8,"Q1") returns 1,000
Example 2
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 =AVERAGEIFS(D2:D8,A2:A8,A11,B2:B8,B11) returns 1,100
Example 3
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 =AVERAGEIFS(D2:D8,A2:A8,"East",D2:D8,">=1000") returns 1,200
Example 4
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 =IFERROR(AVERAGEIFS(D2:D8,A2:A8,"West",B2:B8,"Q3"),"No orders") returns No orders
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.
#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."A11", searches for the text A11. Leave the quotes off, or join with &, for example ">="&F1.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.
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.
No row met every condition. Check the spelling, trailing spaces and data types, or wrap the formula in IFERROR to show a message.
Yes. `=AVERAGEIFS(D2:D13,A2:A13,"East")` gives the same answer as AVERAGEIF, with the average range first.
Up to 127 pairs of criteria range and criteria.
AVERAGEIFS is taught in Data analysis with formulas, lesson 2: COUNTIFS and AVERAGEIFS. Each lesson is a short, graded exercise like the one above.