Conditional function
Excel AVERAGEIFS function
AVERAGEIFS averages a column, but only for rows where every condition is true. Use it for the average hours of one team on one shift, or the average deal size in a region above a minimum.
=AVERAGEIFS(average_range, criteria_range1, criteria1, ...)Arguments
average_range- The cells to average.
criteria_range1- The first range to test.
criteria1- The condition for that range, like "Night" or ">=4".
AVERAGEIFS examples
Every result below was calculated live from this sample sheet.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Employee | Team | Shift | Hours |
| 2 | Ana | Packing | Day | 7.5 |
| 3 | Ben | Packing | Night | 9 |
| 4 | Cal | Shipping | Day | 8 |
| 5 | Dee | Packing | Night | 10.5 |
| 6 | Eli | Shipping | Night | 6 |
| 7 | Fay | Packing | Day | 8.5 |
Result: 9.75
Average hours for the Packing team on night shift.
Result: 8
One condition is fine: the average day-shift length.
Result: 9.3333333333
Average of Packing shifts that ran 8 hours or more.
Result: #DIV/0!
No Shipping shift ran over 10 hours, so this returns #DIV/0!.
How to use AVERAGEIFS
- Click an empty cell.
- Type =AVERAGEIFS( and select the column to average.
- Add a comma, the first range to test, a comma and its condition.
- Add more range, condition pairs as needed.
- Close the bracket and press Enter.
Common AVERAGEIFS mistakes
Putting the average range last
That is AVERAGEIF order. In AVERAGEIFS the range to average comes first.
No rows match every condition
AVERAGEIFS returns #DIV/0! when nothing matches. Wrap it in IFERROR for a clean result.
Ranges of different sizes
All ranges must have the same shape, or Excel returns #VALUE!.
AVERAGEIFS FAQ
What is the difference between AVERAGEIF and AVERAGEIFS?
AVERAGEIF takes one condition and puts the average range last. AVERAGEIFS takes one or more conditions and puts the average range first.
How do I average between two values in Excel?
Use the same range twice: =AVERAGEIFS(D2:D50,D2:D50,">=10",D2:D50,"<=20").
Why is AVERAGEIFS giving #DIV/0!?
No row meets all the conditions at once. Test each condition alone with COUNTIFS to find the one that never matches.
Related functions
AVERAGEIFAverages cells that matchSUMIFSAdds with several conditionsCOUNTIFSCounts with several conditionsAVERAGEMean of numbers
Updated 2026-10-31