Sub topic 1
Why Conditional Totals Matter
Prerequisites.
Assume you can enter and copy Excel formulas, use relative and absolute references, and work with data arranged in rows and columns. The examples use this sales layout:
| Date | Region | Product | Amount |
|---|---|---|---|
| 2025-01-05 | West | Laptop | 1200 |
| 2025-01-09 | East | Monitor | 300 |
| 2025-02-02 | West | Monitor | 310 |
Why conditional totals matter
A regular SUM adds every value in a range. Conditional aggregation calculates a result only for rows that meet conditions. For example, you might need total sales for the West region, the number of West laptop orders, or the average amount for West sales.
The *IFS functions use pairs of ranges and criteria. A criteria range is the column Excel checks. A criterion is the condition that must be true.
flowchart TD
A[Sales rows] --> B[Check criteria]
B --> C[Keep matching rows]
C --> D[SUMIFS adds amounts]
C --> E[COUNTIFS counts rows]
C --> F[AVERAGEIFS averages amounts]How the *IFS functions are built
SUMIFS takes the range to add first. COUNTIFS has no sum range. AVERAGEIFS takes the range to average first. Each function then receives one or more criteria_range, criteria pairs.
The ranges must cover corresponding rows and have the same size. If the amount range covers rows 2 through 100, every criteria range should also cover rows 2 through 100.
SUMIFS: adding values that meet conditions
To total Amount for West sales:
=SUMIFS(D2:D100, B2:B100, "West")The formula adds values in D2:D100 where the corresponding cell in B2:B100 equals "West". Add another pair to narrow the result:
=SUMIFS(D2:D100, B2:B100, "West", C2:C100, "Laptop")This applies AND logic: the row must be West and Laptop.
COUNTIFS: counting rows that meet conditions
COUNTIFS counts matching rows instead of adding a numeric range:
=COUNTIFS(B2:B100, "West", C2:C100, "Laptop")This counts rows where Region is West and Product is Laptop.
AVERAGEIFS: averaging matching values
AVERAGEIFS averages the values that pass its criteria:
=AVERAGEIFS(D2:D100, B2:B100, "West")If no row matches, the result is #DIV/0!. Use IFERROR when a readable result is preferable.
=IFERROR(AVERAGEIFS(D2:D100, B2:B100, "South"), "No sales")Exercise
Which function should you use to count West laptop rows, and what is its formula?
Show answer
Use COUNTIFS: =COUNTIFS(B2:B100, "West", C2:C100, "Laptop").