The AverageIf function in Microsoft Excel returns the average (arithmetic average) of all cells within a range that meet a given condition.
AverageIf (range, Criteria,average_range)
Range required. One or more cells to calculate the average, including numbers or names, arrays, or references that contain numbers. Criteria required. A condition in a number, expression, cell reference, or text form that defines which cells are averaged. For example, a condition can be expressed as 32, "32", ">32", "apple", or B4.
Average_range Optional. The actual set of cells to calculate the average. If omitted, the range is used.
Average_range ignores cells that contain TRUE or FALSE in the range. If the cell in Average_range is an empty cell, AverageIf ignores it.
If the range is a null value or a text value, AverageIf returns #DIV0! The error value.
If the cell in the condition is an empty cell, AverageIf treats it as a value of 0.
If there are no cells in the range that meet the criteria, AverageIf returns #DIV/0! The error value. You can use wildcard characters in a condition, that is, a question mark (?) and an asterisk (*). The question mark matches any single character, and the asterisk matches any sequence of characters.
If you want to find the actual question mark or asterisk, type the tilde (~) before the character. Average_range does not have to be the same size and shape as the range. The actual cells that are averaged are determined by using the upper-left cell in average_range as the starting cell, and then adding a cell that corresponds to the size and shape of the range.
|If the range is||and Average_range is||The actual cell of the calculation is|