Table of Contents
Summary
The Excel AVERAGEIF function calculates the average value from a range of cells with a given condition. The AVERAGEIF function is useful for calculating the average of subset of an overall dataset (with a single criteria).
Formula
=AVERAGEIF(range, criteria, [average_range])
Arguments (inputs)
range = the range of data to test the criteria against (if the average_range is left blank, then this range is also used for the average calculation)
criteria = the criteria to test against the range of data
average_range = [optional] the range of cells to calculate the average from if the condition(s) are true
Return value
The AVERAGEIF formula returns the mathematical average of the average_range (or range if average_range is blank) for the cells that meet the condition defined by the criteria.
Example

In the example above the AVERAGEIF formula in cell N7 calculates average of the range of cells between I6:I35, which is the average age of the college applicants in the example dataset, when the applicant is from the country US, as defined by the cell reference M7.
=AVERAGEIF(H6:H35,M7, I6:I135)
The resulting average of US applicants is returned in cell N7, 25.9 years.