Often you want a total or count of only some rows — sales for one region, students who passed. The *IF functions aggregate with a built-in condition.
SUMIF / COUNTIF / AVERAGEIF
=SUMIF(B2:B100, "Data", C2:C100) sum C where B = "Data"=COUNTIF(B2:B100, "Pass") count cells equal to "Pass"=COUNTIF(B2:B100, ">= 40") count with a comparison=AVERAGEIF(B2:B100, "Data", C2:C100) average C where B = "Data"
Multiple conditions: *IFS
=SUMIFS(C2:C100, B2:B100, "Data", D2:D100, ">7")│ │ │ │ └ 2nd condition│ │ │ └ 2nd criteria range│ └ 1st criteria range + criterion└ the range to SUM (note: comes FIRST in SUMIFS)
Key takeaways
- 01SUMIF/COUNTIF/AVERAGEIF aggregate only rows meeting one condition.
- 02Criteria can be text ("Data") or comparisons (">=40").
- 03SUMIFS/COUNTIFS/AVERAGEIFS handle multiple conditions.
- 04Argument order differs: SUMIF puts the sum range last, SUMIFS puts it first.
