Returns the average of a range depending on criteria. Learn more
In Google Sheets, the AVERAGEIF function is used to calculate the average of a range of values that meet a specific criterion or condition. It allows you to specify a criteria range, a criterion, and an optional average range.
Here is the syntax for the AVERAGEIF function: AVERAGEIF(criteriarange, criterion, [averagerange])
criteriarange: This is the range of cells that you want to evaluate against the criterion. The function will check each cell in this range. criterion: This is the condition or criteria that the cells in the criteria range must meet. It can be a number, text, logical expression, or a cell reference containing a value. averagerange (optional): This is the range of cells that contains the values you want to average. If this parameter is omitted, the AVERAGEIF function will use the cells in the criteria range for averaging.
The AVERAGEIF function calculates the average of only those values in the average range that meet the specified criterion. Cells in the average range that correspond to blank cells or cells with logical values (TRUE/FALSE) in the criteria range are ignored.
Here's an example to illustrate the usage of AVERAGEIF:
Suppose you have a list of sales amounts in cells A1 to A10 and a corresponding list of salespersons' names in cells B1 to B10. You can use the AVERAGEIF function to calculate the average sales amount for a specific salesperson. For example, if you want to calculate the average sales for "John," you can use the following formula:
=AVERAGEIF(B1:B10, "John", A1:A10)
This formula will check the cells in the range B1:B10 for the criterion "John" and average the corresponding sales amounts from A1:A10 for the cells that match the criterion.