[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

AVERAGEIF

Syntax:

AVERAGEIF ( cell-range , selection-criteria [ , average-range ] )

Description: Applies selection criteria on the values in one range of cells and averages the values of the cells in a corresponding range.

Arguments:

Name

Type

Description

cell-range

reference

The range of cells to be inspected. Cells in cell-range that contain TRUE or FALSE are ignored. If a cell is an empty cell, it is ignored.

selection-criteria

number, expression, reference, text

Designates the cells that are to be averaged. In the case of text, selection-criteria can consist of any comparison operator followed by the operand against which each cell's value is to be compared. selection-criteria can include one or more wildcard characters, question mark (?) and asterisk (*). A question mark matches any single character; an asterisk matches any sequence of characters. To search for a question mark, asterisk, or tilde character, prefix that character with a tilde (~). If a cell in selection-criteria is empty, it is treated as if it contained 0.

average-range

reference

Designates the cells whose values are averaged. In this case, average-range need not have the same size and shape as cell-range. The actual cells that are averaged are determined by using the top, left cell in average-range as the beginning cell, and then including cells that correspond in size and shape to cell-range. If average-range is omitted, cell-range also designates the cells whose values are averaged. If a cell is an empty cell, it is ignored.

 

Return Type and Value: number – The average of the values of the cells corresponding to those selected.

However, if no cells in the range meet the criteria, the return value is unspecified.

[Example: Assuming A2:A4 contains 10, 20, and 30:

AVERAGEIF(A2:A4,“>15”) results in 25, the average of 20 and 30.


end example]