Sub topic 3
SUMIFS: Summing a Range by Condition
Assume you can enter formulas, use ranges such as A2:A100, and distinguish text, numbers, and dates. This chapter uses a sales table with these columns:
| Column | Meaning |
|---|---|
| A | Region |
| B | Product |
| C | Date |
| D | Units |
| E | Revenue |
How SUMIFS works
SUMIFS adds numbers only from rows that satisfy one or more conditions. Its argument order is:
=SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])The sum_range comes first. Each condition then consists of a range to test and the value or rule to match.
For example, this formula adds Revenue for rows in the West region:
=SUMIFS(E2:E100, A2:A100, "West")The formula checks each cell in A2:A100. When the cell equals "West", Sheets adds the value from the corresponding row in E2:E100.
Adding several conditions
Add another criteria pair when every condition must be true. This is AND logic:
=SUMIFS(E2:E100, A2:A100, "West", D2:D100, ">=10")This adds Revenue only when the row is in the West region and has at least 10 units.
| Argument | Role |
|---|---|
| `E2:E100` | Values to add |
| `A2:A100, "West"` | First condition |
| `D2:D100, ">=10"` | Second condition |
Comparison operators belong inside text criteria. Common operators include >, <, >=, <=, <>, and =. For example, "<>Cancelled" excludes rows whose status is Cancelled.
You can place a threshold in a cell and join the operator to that cell with &:
=SUMIFS(E2:E100, D2:D100, ">"&H1)If H1 contains 10, this adds Revenue for rows with more than 10 units.
Common errors
All criteria ranges must have the same dimensions as the sum range. For example, E2:E100 should be paired with ranges that also run from row 2 through row 100. A range such as A2:A50 can produce incorrect results or an error because it does not cover the same rows.
Do not reverse the first arguments. This is incorrect:
=SUMIFS(A2:A100, E2:E100, "West")The first range must contain numbers to add. The criteria range must contain the values being tested.
>callout warning > A criterion such as ">=10" is text that describes a comparison. A criterion such as 10 matches the value 10 itself.
SUMIF for one condition
SUMIF is the single-condition version. Its argument order differs:
=SUMIF(criteria_range, criterion, sum_range)Use SUMIFS when you expect to add more conditions later, because its argument order stays consistent as criteria pairs are added.
Exercise
Write a formula that adds Revenue in E2:E100 for East rows with fewer than 5 units.
Show answer
=SUMIFS(E2:E100, A2:A100, "East", D2:D100, "<5")