← Excel and spreadsheets

SUMIF and AVERAGEIF

Add or average only the rows that match a condition.

Start this lesson

=SUMIF(range to check, condition, range to add) adds the values on the rows that match. =AVERAGEIF works the same way but gives the mean of those values. When the condition is about the numbers themselves, you can leave out the third part: =SUMIF(C2:C9,">500").

Example: =SUMIF(B2:B9,"West",C2:C9): West rows have 300, 450 and 125

  1. Find rows where B says West — Check column B
  2. 300 + 450 + 125 — Add their column C values
  3. 875 — SUMIF returns 875

Why it works: The check range and the sum range line up row by row, so when a row passes the test, the number on that same row is the one that gets added.

Tip: SUMIFS and AVERAGEIFS take several conditions; the range to add comes first in those.