A to Z of Excel Functions: The AVERAGEIF Function
5 October 2016
The AVERAGEIF function
Returns the average (arithmetic mean) of all cells in a range that meet a given criterion. It is the “average” equivalent of SUMIF.
The AVERAGEIF function measures what is known as “central tendency”, which is the location of the centre of a group of numbers in a statistical distribution. There are three common measures of central tendency:
- Average: the arithmetic mean, calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5
- Median: the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4. If the number of values in the selection is an even number, the median is defined as the midpoint between the two central numbers
- Mode: the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.
For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.
The AVERAGEIF function employs the following syntax to operate:
AVERAGEIF(range, criterion, [average_range])
The AVERAGEIF function has the following arguments:
- range: this is required. One or more cells to use for the criterion, including numbers, names, arrays or references that contain numbers
- criterion: this is also required. The criterion in the form of a number, expression, cell reference, or text that defines which cells are averaged. For example, criteria can be expressed as 32, "32", ">32", "apples", B4 or “>=”&B4.
- average_range: Optional. The actual set of cells to average. If omitted, range is used. Be careful though: if an average_range is specified that is not of the same dimensions as range, the average_range will be modified by using the top, left cell specified in the range but then use the dimensions that correspond in size and shape to range, e.g.
It should also be noted that:
- Cells in range that contain TRUE or FALSE are ignored
- If a cell in average_range is an empty cell, AVERAGEIF ignores it
- If range is a blank or text value, AVERAGEIF returns the #DIV0! error value
- If a cell in criteria is empty, AVERAGEIF treats it as a zero value
- If no cells in the range meet the criteria, AVERAGEIF returns the #DIV/0! error value
- You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
Please see my example below:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every other business day.