AVERAGEIF
Find the average of cells in a range that meet a single condition.
Spreadsheet editor
Spreadsheet editor
Syntax
=AVERAGEIF(range, criteria, [average_range])
Returns: Number Arguments
| Argument | Required | Description |
|---|---|---|
| range | Yes | The cells you want to test against the criteria. |
| criteria | Yes | The condition a cell must meet, such as a number, text, a comparison like ">50", or a wildcard pattern. |
| average_range | No | The cells to average. If you leave this out, Excel averages the cells in range instead. |
About
Use AVERAGEIF when a plain AVERAGE includes too much. It is the go-to for questions like the average sale for one region, the average score above a passing grade, or the average order value for a single customer. The criteria can be a number, text, a comparison like ">100", or a wildcard pattern, so it handles both text and numeric filters.
When you need more than one condition, reach for AVERAGEIFS instead. For conditional totals and counts, the matching tools are SUMIF and COUNTIF, which use the same criteria style.
Exercises using AVERAGEIF
Examples
Average only the passing scores
Spreadsheet editor
Avoid the #DIV/0! error
Spreadsheet editor
Pull the threshold from a cell
Spreadsheet editor
Watch out for
#DIV/0! when nothing matches
If no cells meet the criteria, or the range only holds text and blanks, AVERAGEIF returns #DIV/0! because it has no numbers to divide.
→ Double-check that your criteria matches the data exactly, then wrap the formula in IFERROR to show a friendly message like "No data" instead of the error.
Forgetting quotes around comparisons
Writing the criteria as >100 without quotes causes an error. Comparisons and text must be inside double quotes.
→ Always quote text and operator criteria, like ">100" or "West". To combine an operator with a cell reference, use ">"&E1.
Mismatched range sizes
When range and average_range cover different numbers of cells, Excel starts at the top-left cell of average_range and reads cells that match the shape of range, which can average the wrong rows.
→ Keep range and average_range the same size and aligned to the same rows so each tested cell lines up with the value you want to average.