Excel guide · 5 min read
How to use AVERAGEIF and AVERAGEIFS in Excel
=AVERAGEIF(C2:C11,"Chat",E2:E11) averages the values in E only for rows where column C is "Chat". The order is range to test, condition, then range to average. For two or more conditions use AVERAGEIFS, which puts the range to average first: =AVERAGEIFS(E2:E11,C2:C11,"Chat",A2:A11,">="&H3). Both return #DIV/0! when no row matches.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Date | Agent | Channel | Category | Hours to resolve | Channel | Chat | |
| 2 | Oct 1, 2026 | Maya Chen | Billing - refund | 6.5 | Slower than (h) | 2 | ||
| 3 | Oct 2, 2026 | Tom Walsh | Chat | Login | 0.5 | From | Oct 1, 2026 | |
| 4 | Oct 5, 2026 | Maya Chen | Phone | Billing - invoice | 2 | To | Oct 31, 2026 | |
| 5 | Oct 7, 2026 | Ravi Kumar | Chat | Shipping - delay | 1.5 | |||
| 6 | Oct 12, 2026 | Tom Walsh | Login | 4 | ||||
| 7 | Oct 15, 2026 | Ravi Kumar | Billing - refund | 9 | ||||
| 8 | Oct 21, 2026 | Maya Chen | Chat | Billing - invoice | 1 | |||
| 9 | Oct 28, 2026 | Tom Walsh | Phone | Shipping - lost | 5.5 | |||
| 10 | Nov 2, 2026 | Ravi Kumar | Chat | Billing - refund | 2.5 | |||
| 11 | Nov 3, 2026 | Maya Chen | Phone | Shipping - delay |
Download this sheet as an Excel practice file (.xlsx)
AVERAGEIF with one condition
The sheet is a support team's ticket log: date, agent, channel, category and how many hours each ticket took to resolve. To get the average resolution time for chat tickets, AVERAGEIF tests column C and averages column E: =AVERAGEIF(C2:C11,"Chat",E2:E11).
Typing "Chat" into the formula works, but a cell is better. Put the channel in H1 and point the condition at it, then change H1 to Email or Phone and the result follows. Text conditions are not case-sensitive, so "chat" matches Chat.
The third argument is optional. Leave it out and AVERAGEIF averages the tested range itself, which is how =AVERAGEIF(E2:E11,">0") averages only the positive values in one column.
Result: 1.375
1.375 hours: the four chat tickets took 0.5, 1.5, 1 and 2.5 hours.
Conditions with operators: greater than, less than, not equal
Put the operator and the number inside one pair of quotes: ">2", "<=4", "<>0". To compare with a cell, keep the operator in quotes and join the cell with &. This averages only the slow tickets, the ones that took more than the hours in H2.
For "not equal" on text, "<>Email" averages every ticket that did not come in by email. The same idea works on any column: =AVERAGEIF(C2:C11,"<>Email",E2:E11) returns 2.17 hours.
Result: 5.5
5.5 hours: the five tickets over 2 hours (6.5, 4, 9, 5.5 and 2.5).
The quote trap: ">H2" compares with the letters H2
Inside quotes, H2 is just text, so Excel looks for hours greater than the word "H2". No number matches, nothing is averaged, and you get #DIV/0! even though there are plenty of slow tickets. The fix is the formula in the previous section: ">"&H2.
Result: #DIV/0!
#DIV/0!: no row matched the text condition.
Wildcards: average by part of the text
The categories are "Billing - refund", "Billing - invoice" and so on. An asterisk matches any number of characters, so "Billing*" matches every category that starts with Billing. "*refund" matches anything that ends in refund, and "*refund*" anything that contains it. A question mark matches exactly one character.
To search for a real asterisk or question mark, put a tilde in front of it: "~*". Wildcards only work on text; they do nothing on numbers or dates.
Result: 4.2
4.2 hours: the five billing tickets, refunds and invoices together.
AVERAGEIFS: several conditions and a date range
AVERAGEIFS takes the range to average first, then pairs of range and condition. A row counts only if every condition is true. For a date range, use the date column twice: once with ">=" and the start date, once with "<=" and the end date. Here H3 and H4 hold October 1 and October 31.
Without the channel condition, =AVERAGEIFS(E2:E11,A2:A11,">="&H3,A2:A11,"<="&H4) is the October average for every channel: 3.75 hours. Keep the dates in cells or build them with DATE(2026,10,1). A date typed as text inside the condition, such as ">=10/1/2026", depends on your regional settings and breaks when the file is opened elsewhere.
AVERAGEIFS exists in Excel 2007 and later, so it works in every current version.
Result: 1
1 hour: the three October chat tickets (0.5, 1.5 and 1). The November chat ticket is left out.
#DIV/0! when nothing matches
An average is a sum divided by a count. When no row meets the condition, the count is 0 and AVERAGEIF returns #DIV/0!. No tickets came in on Social, so =AVERAGEIF(C2:C11,"Social",E2:E11) shows the error. It is not a bug, but it looks like one on a dashboard.
Wrap the formula in IFERROR and show a message or a blank (""). Do not show 0: a 0 average looks like a real, very fast result.
Result: No tickets
No tickets. With "Chat" instead of "Social" it returns 1.375.
Blanks are skipped, zeros are not
Maya's phone ticket in row 11 is still open, so its hours cell is empty. AVERAGEIF skips empty cells in the range it averages, so the phone average is 3.75 hours from the two closed tickets. If someone had typed 0 for "not resolved yet", the average would drop to 2.5, because a 0 is a number and gets counted.
Leave unknown values empty, or exclude zeros with a second condition: =AVERAGEIFS(E2:E11,C2:C11,"Phone",E2:E11,"<>0"). Text such as "open" in the hours column is also skipped, but it hides the problem; an empty cell is clearer.
Result: 3.75
3.75 hours: the average of 2 and 5.5. The open ticket is ignored.
Which one to pick
One condition: AVERAGEIF is fine. Two or more, or a date range: AVERAGEIFS. Many people use AVERAGEIFS even for one condition, because its argument order matches SUMIFS and COUNTIFS and adding a second condition later needs no rewrite.
If you need OR logic, a test on a calculated value, or the result for every group at once, Excel 365 users can use =AVERAGE(FILTER(E2:E11,C2:C11="Chat")) or a PivotTable with the value field set to Average. For skipping zeros specifically, see the guide on averaging without zeros.
Common mistakes
Mixing up the argument order
AVERAGEIF is (range to test, condition, range to average). AVERAGEIFS is (range to average, range to test, condition, ...). Swapping them averages the wrong column or returns #DIV/0!.
Ranges of different sizes
AVERAGEIF quietly resizes the average range to match the tested range, starting from its top-left cell, so E1:E10 against C2:C11 averages the wrong rows without an error. AVERAGEIFS returns #VALUE! instead. Always use ranges that start and end on the same rows.
Typing 0 for missing values
Zeros are averaged, blanks are not. Leave the cell empty or add a "<>0" condition.
Hours or scores stored as text
Numbers pasted as text are skipped like blanks, so the average is based on fewer rows than you think. Compare COUNTIFS on the same conditions with the number of rows you expect, and convert the column if they differ.
FAQ
What is the difference between AVERAGEIF and AVERAGEIFS?
AVERAGEIF takes one condition and puts the range to average last. AVERAGEIFS takes one or more conditions and puts the range to average first. For a single condition both give the same answer.
How do I average between two dates in Excel?
Use AVERAGEIFS with the date column twice: =AVERAGEIFS(E2:E11,A2:A11,">="&H3,A2:A11,"<="&H4), with the start date in H3 and the end date in H4.
Why does AVERAGEIF return #DIV/0!?
No row met the condition, so there is nothing to average. Check the spelling and spaces in the condition, check that operators and cells are joined with &, and wrap the formula in IFERROR if an empty group is normal.
Can AVERAGEIF use a cell reference as the condition?
Yes. =AVERAGEIF(C2:C11,H1,E2:E11) uses whatever is in H1. With an operator, join it: ">"&H2.
Does AVERAGEIF ignore blank cells?
Yes. Empty cells in the range being averaged are skipped. Cells that contain 0 are included.
Functions used
AVERAGEIFAverages cells that matchAVERAGEIFSAverages with several conditionsAVERAGEMean of numbersIFERRORFallback when a formula errorsFILTERKeeps matching rows, spillsCOUNTIFSCounts with several conditionsDATEBuilds a date
Related guides
- How to calculate an average in Excel
- Average excluding zeros (and blanks) in Excel
- #DIV/0! error in Excel
- SUMIFS between two dates in Excel
- How to find the median in Excel
- How to average time and durations in Excel
- COUNTIFS between two numbers in Excel
Updated