Average if
AVERAGEIF Function¶
The AVERAGEIF function in Excel calculates the average (arithmetic mean) of all the cells that meet a specified
condition (criteria) within a given range.
Key Features of AVERAGEIF:¶
- Averages only those numbers in a range that satisfy a specific condition or criteria.
- Supports conditions with numeric values, text, or operators (e.g.,
>,<,=). - Optionally allows defining a separate range for average calculation.
This function is useful for calculating averages dynamically based on specific rules or conditions.
Syntax:¶
- range: (Required) The range of cells to be evaluated using the criterion.
- criteria: (Required) The condition that determines which cells are included in the average.
- Can be a number (e.g.,
10), expression (e.g.,">5"), text (e.g.,"apples"), or reference to a cell containing the condition.
- Can be a number (e.g.,
- average_range: (Optional) The range of cells to be averaged. If omitted,
rangeis used.
Examples:¶
-
Basic Usage
Averages all numbers in the rangeA1:A10that are greater than 5. -
Using Text as Criteria
Calculates the average of cells inB1:B10where the values equal "Apples". -
With Separate Average Range
Averages values in the rangeB1:B10where the corresponding values inA1:A10are greater than 5. -
Using Cell Reference for Criteria
Uses the value or condition stored in cellC1as the criterion. -
With Wildcards
Averages values inA1:A10where the text starts with "Ap" (e.g., "Apple", "Apricot"). The*wildcard represents any number of characters.
Notes:¶
- Wildcards: The
?and*wildcards can be used in thecriteriafor matching text:?matches any single character.*matches any number of characters.- To use literal
?or*, place a tilde (~) before them (e.g.,"a~*"matches "a*").
- Empty Criteria: If
average_rangehas numeric and non-numeric values, only numeric ones are averaged. - Errors: If no cells meet the criteria or the range is empty, the function will return a
#DIV/0!error.
Tip: Use
AVERAGEIFwhen you need conditional averages and precise control over what gets factored into your calculations.