Sub topic 4
SUMIFS: Sum Range First, Then Criteria Pairs
Assume you know basic Excel formulas, relative and absolute references, and the structure of a simple budget or financial statement. You should also understand that a ledger stores many transaction rows, while a report usually needs grouped totals.
The SUMIFS working model
SUMIFS adds values from a sum range only when every supplied condition is true. Its argument order is:
=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)The sum range comes first. Each condition then appears as a pair:
- The criteria range contains the values Excel tests.
- The criterion tells Excel what must match.
For example, assume the Data sheet has account names in column B and amounts in column F:
=SUMIFS(Data!$F$2:$F$5000, Data!$B$2:$B$5000, $A5)This formula adds amounts in column F for rows where the account in column B equals the account name in A5.
| Argument | Example | Purpose |
|---|---|---|
| Sum range | Data!$F$2:$F$5000 | Values to add |
| Criteria range | Data!$B$2:$B$5000 | Values to test |
| Criteria | $A5 | Required account name |
All ranges should cover the same rows. If the sum range ends at row 5000 but a criteria range ends at row 4000, the formula can produce incorrect or confusing results. Bounded ranges also avoid scanning unnecessary blank rows.
Adding criteria pairs
To filter by more than one condition, append another criteria-range and criterion pair. Suppose column C contains categories:
=SUMIFS(Data!$F$2:$F$5000, Data!$B$2:$B$5000, $A5, Data!$C$2:$C$5000, B$4)This totals the selected account and category. SUMIFS applies AND logic: a row must satisfy both conditions before its amount is included.
The reference styles make the formula useful across a report:
$A5keeps the account column fixed when copying across months.B$4keeps the category row fixed when copying down accounts.$F$2:$F$5000keeps the source range fixed in every direction.
Criteria text, operators, and dates
A text criterion can be a cell reference or a quoted value. Operators are written as text and joined to a cell reference with &:
=SUMIFS(Data!$F$2:$F$5000, Data!$F$2:$F$5000, ">="&$B$2)This adds amounts greater than or equal to the threshold in B2. Common operators include =, <>, >, <, >=, and <=.
Wildcards help when the source text is not standardized. An asterisk represents any number of characters:
=SUMIFS(Data!$F$2:$F$5000, Data!$C$2:$C$5000, "Opex*")This includes categories such as Opex, Opex - Payroll, and Opex - Rent. Use wildcards carefully because they can include unintended labels.
For dates, use a lower and upper boundary. This avoids relying on text formatting and includes every date in the period.
=SUMIFS(Data!$F$2:$F$5000, Data!$D$2:$D$5000, ">="&C$3, Data!$D$2:$D$5000, "<="&EOMONTH(C$3,0))Here, C3 contains the first day of the month. EOMONTH returns the last day of that month.
Exercise
What does this formula total: =SUMIFS(Data!$F$2:$F$5000, Data!$B$2:$B$5000, $A5, Data!$C$2:$C$5000, "Opex*")?
Show answer
It totals column F for rows whose account matches A5 and whose category begins with Opex.