Sub topic 2
How the *IFS Functions Are Built
This chapter assumes you can enter and copy formulas, understand relative and absolute references, and have used SUM, COUNT, and AVERAGE on data with headers. SUMIFS, COUNTIFS, and AVERAGEIFS are called the *IFS functions here because they share one structure. Learn it once and you can read all three.
The shared pattern
Each function takes one or more pairs of arguments. Every pair holds a criteria range (the cells to test) and a criterion (the test to apply). A row counts only when every pair passes.
The functions differ in one way. SUMIFS and AVERAGEIFS need a range of numbers to work on, so that range comes first. COUNTIFS only counts rows, so it has no such range.
| Function | Argument order |
|---|---|
| SUMIFS | sum_range, criteria_range1, criteria1, criteria_range2, criteria2, ... |
| COUNTIFS | criteria_range1, criteria1, criteria_range2, criteria2, ... |
| AVERAGEIFS | average_range, criteria_range1, criteria1, criteria_range2, criteria2, ... |
The examples in this tutorial use this sales layout. Headers are in row 1 and data runs from row 2 to row 100.
A: Date B: Region C: Product D: Amount E: Notes
2025-01-05 West Laptop 1200
2025-01-09 East Monitor 300 Backorder
2025-02-02 West Monitor 310
2025-02-14 North Laptop 1150 GiftReading a formula
Here is SUMIFS with a single pair:
=SUMIFS(D2:D100, B2:B100, "West")Read it in two parts. D2:D100 is the range to add. B2:B100, "West" is the pair that says which rows qualify. On the four sample rows, the formula adds 1200 and 310.
COUNTIFS has no range to add, so every argument belongs to a pair:
=COUNTIFS(B2:B100, "West", C2:C100, "Laptop")A row is counted only when Region is West and Product is Laptop. Adding more pairs always narrows the result, because the pairs are combined with AND.
AVERAGEIFS follows the SUMIFS order:
=AVERAGEIFS(D2:D100, B2:B100, "West")Rules that follow from the structure
- Every criteria range must have the same number of rows and columns as the sum or average range. Mismatched sizes cause
#VALUE!. - Criteria ranges can be in different columns, and the same column can appear in more than one pair.
- Arguments come in pairs, so a missing criterion is an error.
- The sum range does not have to sit next to the criteria ranges.
Exercise
You want the average Amount for rows where Product is "Monitor" and Region is "East". Write the formula, and say which argument comes first and why.
Show answer
=AVERAGEIFS(D2:D100, C2:C100, "Monitor", B2:B100, "East"). The range to average, D2:D100, comes first because AVERAGEIFS needs to know which values to average before it reads the criteria pairs. The two pairs can appear in either order. On the sample rows this returns 300.