Conditional totals function
SUMIFS function in Google Sheets and Excel
SUMIFS adds the numbers in a range on the rows that meet every condition you give it.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)Arguments in [brackets] are optional. Google Sheets writes it SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...]).
Example
=SUMIFS(F2:F13,E2:E13,"Plants",H2:H13,"Shipped") reads: Add the quantities F2:F13 on the rows where the category E2:E13 is Plants and the status H2:H13 is Shipped.
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | Date | Customer | Product | Category | Qty | Price | Status | Plants shipped | 14 | |
| 2 | 1001 | 2 Mar 2026 | Mara Okafor | Monstera | Plants | 1 | $34.00 | Shipped | |||
| 3 | 1002 | 2 Mar 2026 | Jonas Lind | Terracotta pot | Pots | 3 | $12.50 | Shipped | |||
| 4 | 1003 | 3 Mar 2026 | Priya Raman | Snake plant | Plants | 2 | $22.00 | Shipped | |||
| 5 | 1004 | 4 Mar 2026 | Tomás Ruiz | Watering can | Tools | 1 | $18.00 | Pending | |||
| 6 | 1005 | 5 Mar 2026 | Elif Demir | Fern | Plants | 4 | $9.50 | Shipped | |||
| 7 | 1006 | 5 Mar 2026 | Mara Okafor | Potting mix | Soil | 2 | $7.25 | Returned | |||
| 8 | 1007 | 6 Mar 2026 | Kenji Mori | Pruning shears | Tools | 1 | $24.00 | Shipped | |||
| 9 | 1008 | 7 Mar 2026 | Ines Varga | Ceramic pot | Pots | 2 | $19.00 | Pending | |||
| 10 | 1009 | 8 Mar 2026 | Jonas Lind | Monstera | Plants | 1 | $34.00 | Shipped | |||
| 11 | 1010 | 9 Mar 2026 | Sofia Rossi | Fern | Plants | 6 | $9.50 | Shipped | |||
| 12 | 1011 | 10 Mar 2026 | Priya Raman | Potting mix | Soil | 5 | $7.25 | Shipped | |||
| 13 | 1012 | 11 Mar 2026 | Leo Brandt | Snake plant | Plants | 1 | $22.00 | Pending |
K1 shows 14: the quantities of the Plants orders that have shipped (1 + 2 + 4 + 1 + 6, but not the pending Snake plant).
How the spreadsheet calculates it
Adds up the values in F2:F13 on the rows where E2:E13 is equal to "Plants" and H2:H13 is equal to "Shipped".
- 1. SUMIFS: Adds up the values in
F2:F13on the rows whereE2:E13is equal to"Plants"andH2:H13is equal to"Shipped".sum_range=`F2:F13`: the cells to addrange1=`E2:E13`: the first column to checkcriteria1=`"Plants"`: what it must matchrange2=`H2:H13`: the next column to checkcriteria2=`"Shipped"`: what that must match
More SUMIFS examples
=SUMIFS(F2:F13,E2:E13,"Plants")Total quantity of plant orders.=SUMIFS(F2:F13,B2:B13,">="&K1,B2:B13,"<="&K2)Total between two dates in K1 and K2.=SUMIFS(F2:F13,D2:D13,"*pot*")Total for products whose name contains “pot”.=SUMIFS($E$2:$E$17,$B$2:$B$17,$H2,$C$2:$C$17,I$1)One formula for a whole region × product grid.
Paste any of these into the formula explainer to see it step by step.
Tips
- Keep criteria in cells and join operators with
&, so totals update when someone changes K1. - Lock the ranges with
$before filling a summary grid across and down. - Check a total once against a filtered view of the same rows before trusting it.
- Use the same rows for every range: if sum_range is F2:F13, every criteria range ends on row 13 too.
What SUMIFS is used for
Monthly sales by region, spend by category and month, hours by project and person: any total that needs filtering first, and the summary grids most reports are built from.
Arguments
| Argument | Required | What it is |
|---|---|---|
| sum_range | Yes | The numbers to add. In SUMIFS it comes first.Watch out: Pointing it at text adds nothing: the total is 0. |
| criteria_range1 | Yes | The range to test against the first condition, the same size as sum_range. |
| criteria1 | Yes | The condition: text in quotes, a number, a comparison in quotes like ">=3", a cell, or a wildcard. |
| criteria_range2, criteria2 | No | More range and condition pairs. A row counts only if it meets all of them. |
Common mistakes
Copying SUMIF's order and putting the sum range last.
Expecting OR logic: every condition must match.
Writing a cell inside the quotes, like ">=K1": join it instead, ">="&K1.
Expecting OR between conditions: add two SUMIFS together.
In Google Sheets
Google Sheets' SUMIFS has the same arguments in the same order, sum range first.
Errors you may see with SUMIFS
- #VALUE!: A criteria range isn't the same size as sum_range, or the formula reads a closed workbook.
Questions
Why does SUMIFS return 0?
No row meets every condition: usually a typo, a space or text-numbers. See SUMIFS returns 0.
How do I sum between two dates?
Use the date column twice: SUMIFS(F2:F13, B2:B13, ">="&K1, B2:B13, "<="&K2). See SUMIFS dates not working.
Does the order of the conditions matter?
No. Each condition must match, whatever order you list them in; only the sum range has to come first.
Sources
Official documentation the facts on this page were checked against.