Sub topic 3
SUMIFS: summing a range by condition
SUMIFS adds up the numbers in one range, but only for rows where one or more conditions are true. This chapter covers its syntax, how it differs from COUNTIFS, how criteria are evaluated, and the errors you will meet most often.
Prerequisites
This chapter assumes you can:
- Enter and edit formulas in Google Sheets.
- Read range notation such as
A2:A100. - Use SUM, COUNT, and AVERAGE.
- Tell apart text, numbers, and dates stored in cells.
It also builds on COUNTIFS from the previous chapter. Criteria work the same way in both functions.
The working model
Picture a table of sales rows:
| Row | A: Region | B: Product | C: Date | D: Units | E: Revenue |
|---|---|---|---|---|---|
| 2 | West | Widget | 2026-01-05 | 12 | 240 |
| 3 | East | Widget | 2026-01-09 | 4 | 80 |
| 4 | West | Gadget | 2026-02-02 | 8 | 400 |
| 5 | West | Widget | 2026-01-20 | 15 | 300 |
SUMIFS walks down the rows. For each row it checks every condition. If all of them are true, it adds that row's value from the sum range to a running total.
=SUMIFS(E2:E100, A2:A100, "West")This adds the Revenue values in E2:E100 for rows where Region in A2:A100 is "West". On the sample table the result is 240 + 400 + 300 = 940.
Syntax and argument order
=SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])The range to add comes first. Each condition after it is a pair: a range to test, then the test to apply.
This is the main difference from COUNTIFS, which has no sum range and starts directly with the first criteria range. When you convert a COUNTIFS formula to SUMIFS, insert the sum range at the front.
Adding more conditions
Each extra pair narrows the result, because all pairs must be true for a row to count. This is AND logic.
=SUMIFS(E2:E100, A2:A100, "West", D2:D100, ">=10")On the sample table this adds Revenue for West rows with at least 10 units: rows 2 and 5, giving 540. Row 4 is West but has only 8 units, so it is skipped.
Order among the pairs does not matter. Only the sum range must be first.
Operators in criteria
A criterion can start with a comparison operator. The operator and value go together in one text string.
| Criterion | Meaning |
|---|---|
| `"West"` or `"=West"` | equals West |
| `">10"` | greater than 10 |
| `">=10"` | greater than or equal to 10 |
| `"<10"` | less than 10 |
| `"<=10"` | less than or equal to 10 |
| `"<>West"` | not equal to West |
A criterion with no operator means "equals". Text matching is not case-sensitive, so "west" matches "West".
Taking the threshold from a cell
Typing a threshold inside the formula makes it hard to change. Join the operator to a cell value with &:
=SUMIFS(E2:E100, D2:D100, ">"&H1)If H1 holds 10, the criterion becomes the text ">10". Change H1 and the result updates. Note that the operator stays in quotes and the cell reference stays outside them.
A plain reference such as A2:A100, G2 also works when you want "equals the value in G2".
Date ranges
Dates are numbers underneath, so you can compare them with operators. To select a month, use the same date column twice: once for the start and once for the exclusive end.
=SUMIFS(E2:E100, A2:A100, "West", C2:C100, ">="&DATE(2026,1,1), C2:C100, "<"&DATE(2026,2,1))This sums West revenue dated in January 2026. Using "less than 1 February" instead of "less than or equal to 31 January" also works for date-times that include a time of day.
On the sample table the rows dated 2026-01-05 and 2026-01-20 match, giving 240 + 300 = 540.
Wildcards
In text criteria, * matches any number of characters (including none) and ? matches exactly one character. To match a literal * or ?, put ~ before it.
=SUMIFS(E2:E100, B2:B100, "Wid*")This sums Revenue for products whose name starts with "Wid". Wildcards work only with text criteria on text cells, and only with equals or not-equals. They do not apply to numbers.
Blank and non-blank cells
Use "<>" for "not empty":
=SUMIFS(E2:E100, B2:B100, "<>")This sums Revenue where the Product cell is not empty. To test for empty cells, use "" as the criterion. Be aware that a cell containing a formula that returns an empty string is treated as blank by "" but still counts as non-empty in some situations. If results look wrong, check whether those cells hold real blanks or formula output.
Ranges must be the same size
The sum range and every criteria range must have the same number of rows and columns. If they differ, SUMIFS returns an error rather than a partial answer.
=SUMIFS(E2:E100, A2:A99, "West")This formula fails because E2:E100 has 99 rows and A2:A99 has 98. The fix is to make both end at the same row. Ranges do not need to be next to each other. They only need to match in shape.
A common cause is inserting rows or editing one reference by hand while leaving the others unchanged.
OR logic
Pairs combine with AND, so SUMIFS cannot say "West or East" in a single set of pairs. Add the results of separate conditions instead. An array constant does this in one formula:
=SUM(SUMIFS(E2:E100, A2:A100, {"West","East"}))SUMIFS runs once per item in the array, returning two totals, and SUM adds them. This is safe here because a row cannot be both West and East. If the two conditions could overlap, a row would be counted twice, so use a different approach.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Result is 0 but matching rows exist | Numbers or dates stored as text, or extra spaces in the criteria range | Convert the data, or clean with TRIM |
| Formula parse error or size error | Ranges of different sizes | Make all ranges the same shape |
| Result ignores the operator | Operator and value written separately, such as `">", H1` | Use `">"&H1` |
| Wrong total after copying down | Relative references shifted | Anchor ranges with `$`, such as `$E$2:$E$100` |
| Wildcard does not match | Cells are numbers, or a `~` is needed for a literal `*` | Match text only, or escape with `~` |
Unlike AVERAGEIFS, SUMIFS does not produce #DIV/0! when nothing matches. It returns 0. That can hide a mistake, since a wrong criterion and a true total of zero look the same.
SUMIF versus SUMIFS
SUMIF is the older single-condition function. Its argument order differs:
=SUMIF(range, criterion, [sum_range])Here the test range comes first and the sum range is optional and last. SUMIFS always requires the sum range first. If you mix up the two orders, you get wrong results or errors. Using SUMIFS even for one condition keeps your formulas consistent and easy to extend.
Putting it together
When copying a formula down a summary table, anchor the data ranges and leave the criteria cell relative:
=SUMIFS($E$2:$E$100, $A$2:$A$100, G2)With region names in G2, G3, and so on, filling down gives one total per region. Absolute references ($E$2:$E$100) stay fixed while G2 moves to G3, G4, and so on.
Exercise
Using the sample table, write a SUMIFS formula that returns Revenue for rows where Product is "Widget" and Units is greater than a threshold stored in H1. Then say what you would change so that it also covers only dates before 1 February 2026.
Show answer
=SUMIFS(E2:E100, B2:B100, "Widget", D2:D100, ">"&H1). To restrict dates, add another pair using the date column: ..., C2:C100, "<"&DATE(2026,2,1). The full formula is =SUMIFS(E2:E100, B2:B100, "Widget", D2:D100, ">"&H1, C2:C100, "<"&DATE(2026,2,1)).
Exercise
This formula returns an error: =SUMIFS(E2:E100, A2:A90, "West"). What is wrong, and how do you fix it?
Show answer
The sum range E2:E100 has 99 rows but the criteria range A2:A90 has 89. All ranges in SUMIFS must be the same size. Change the criteria range to A2:A100.