The Excel AVERAGEIF function finds the values in a supplied array that satisfy a specified criteria, and returns the average (ie. the statistical mean) of the corresponding values in a second supplied array.
The function is new in Excel 2007, and so is not available in earlier versions of Excel.
The syntax of the Averageif function is:
Where the function arguments are:
|range||-||An array of values (or range of cells containing values) to be tested against the supplied criteria.|
|criteria||-||The condition to be tested against each of the values in range.|
|[average_range]||-||[average_range] argument is omitted, the average is calculated for values in the initial supplied range.If the|
You can also use the following wildcards in text-related criteria:
? - matches any single character
* - matches any sequence of characters
if you do actually want to find the ? or * character, type the ~ symbol before this character in your search.eg. the condition "A*e" will match all cells containing a text string beginning with "A" and ending in "e".
The supplied criteria can be either:
Note also that the Excel Averageif function is not case-sensitive. So, for example, the text strings "TEXT" and "text" will be classed as equal.
The following spreadsheets shows several examples of the Excel Averageif function.
For each call to the Excel Averageif function the range argument (to be tested against the criteria) is the cell range A1 - A14 and the [average_range] argument (containing the values to be averaged) is the cell range B1 - B14.
The averageif function is entered into cells A16 - A20 (highlighted in yellow):
Note that, in cells A16, A18 and A20 of the above 'Formulas' spreadsheet, the text value "Thursday" and the expressions ">2" and "<>TRUE" are encased in quotes.
Further examples of the Excel Averageif function can be found on the Microsoft Office website.
The most common errors from the Excel Averageif function are listed in the table below:
|#VALUE!||-||Occurs if the criteria argument is a text string with length greater than 255 characters.|