SheetsLessons
Lesson 15 · Conditional Math

AVERAGEIF Function

Practice AVERAGEIF in Google Sheets: average only the values that meet a condition.

Task 1 of 3

What is the average score for students in class B? Answer in E2.

E2
fx

Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.

Conditional averages

=AVERAGEIF(criteria_range, criterion, [average_range])
=AVERAGEIFS(average_range, criteria_range1, criterion1, ...)

AVERAGEIF works like SUMIF, but returns the mean of the matching values instead of the total. AVERAGEIFS is the multi-condition version, and like SUMIFS it puts the average range first.

If nothing matches, you'll get #DIV/0!. Wrap it in IFERROR if that can happen in your data.