Function · Statistical
Excel AVERAGEIF function
The Excel AVERAGEIF function averages numbers whose neighbor matches one test. The two Electric bills, $143.60 and $118.45, average $131.025.
Syntax =AVERAGEIF(range, criteria, [average_range])
=AVERAGEIF(A2:A5,"Electric",B2:B5)Arguments
| Name | Required | What to pass |
|---|---|---|
| range | Required | The cells to test. |
| criteria | Required | The test. A word, a number, or an expression such as ">100". Text matches ignore case. * and ? are wildcards. |
| average_range | Optional | The numbers to average. If you omit it, the tested range is averaged. It must be the same shape as range. |
Examples
Average of the Electric rows only
=AVERAGEIF(A2:A5,"Electric",B2:B5)Result $131.025
| A | B | |
|---|---|---|
| 1 | Category | Amount |
| 2 | Electric | 143.60 |
| 3 | Gas | 96.20 |
| 4 | Water | 48.00 |
| 5 | Electric | 118.45 |
| 6 | Electric average | 131.025 |
AVERAGEIF averages one group. Electric is $143.60 and $118.45, so the average is $131.025. Gas and Water stay out of the total and out of the count. That is the difference from AVERAGE of the whole column, which would mix every category and land on a number that describes none of them.
The test is not case-sensitive, and a criterion of ">100" works when the range itself holds the numbers. Leave average_range off in that case. When the word is in column A and the dollars are in column B, pass both ranges, and keep them the same height. One test is the limit. A city and a category together need AVERAGEIFS.