SUMIF and SUMIFS
The same sales sheet as the COUNTIF lesson, with Raj's amount in D6 left empty:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Date | Region | Rep | Amount |
| 2 | 03-06-2024 | North | Asha | 1200 |
| 3 | 05-06-2024 | South | Leo | 800 |
| 4 | 11-06-2024 | North | Mei | 450 |
| 5 | 14-06-2024 | East | Asha | 2300 |
| 6 | 18-06-2024 | South | Raj | |
| 7 | 21-06-2024 | North | Asha | 950 |
| 8 | 27-06-2024 | East | Leo | 1600 |
SUMIF
=SUMIF(B2:B8, "North", D2:D8) → 2600 1200 + 450 + 950
=SUMIF(D2:D8, ">1000") → 5100 1200 + 2300 + 1600=SUMIF(range_to_check, criteria, range_to_add)Excel checks each cell in the first range, and for every match adds the cell in the same row of the third range. When the cells you check are the cells you add, as in the second example, leave the third argument out.
The criteria work exactly as in COUNTIF: ">1000", "<>East", "A*", or ">"&F1 for a value in a cell.
SUMIFS: several conditions
=SUMIFS(D2:D8, B2:B8, "North", C2:C8, "Asha") → 2150 1200 + 950SUMIFS adds the values where every condition is true: here, Asha's sales in the North.
Between two dates
=SUMIFS(D2:D8, A2:A8, ">="&DATE(2024,6,10), A2:A8, "<"&DATE(2024,6,20)) → 2750Two conditions on the same column make a range: on or after 10 June, and before 20 June. That's 450 + 2300, with Raj's empty cell on 18 June counting as nothing. Build dates with DATE(year, month, day) rather than typing them inside the quotes, which avoids confusion between day-month and month-day order.
AVERAGEIF, MAXIFS and MINIFS
=AVERAGEIF(B2:B8, "East", D2:D8) → 1950 (2300 + 1600) / 2
=MAXIFS(D2:D8, B2:B8, "South") → 800 the empty cell is ignored
=MINIFS(D2:D8, B2:B8, "North") → 450AVERAGEIF and AVERAGEIFS follow the same pattern as their SUM cousins. MAXIFS and MINIFS (Excel 2019 and later) take the value range first, like SUMIFS.
A summary table
Combine the functions with references, and one formula fills a whole report:
| F | G | |
|---|---|---|
| 1 | Region | Total |
| 2 | North | =SUMIFS($D$2:$D$8, $B$2:$B$8, F2) |
| 3 | South | 800 |
| 4 | East | 3900 |
The formula in G2 takes the region from F2, and the data ranges are locked with $, so filling it down to G4 gives every region's total. This is a hand-made version of what a PivotTable does automatically.