formulastreak

Conditional totals function

SUMIF function in Google Sheets and Excel

SUMIF adds the numbers in a range that meet one condition, such as every order in the Plants category.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

SUMIF(range, criteria, [sum_range])

Arguments in [brackets] are optional. Google Sheets writes it SUMIF(range, criterion, [sum_range]).

Example

=SUMIF(E2:E13,"Plants",I2:I13) reads: Look down the Category column E2:E13 for "Plants" and add the matching rows' totals from I2:I13.

Leaf & Loam orders · edit L1 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultL1 = $229.00
ABCDEFGHIJKL
1OrderDateCustomerProductCategoryQtyPriceStatusTotalPlants revenue$229.00
210012 Mar 2026Mara OkaforMonsteraPlants1$34.00Shipped$34.00
310022 Mar 2026Jonas LindTerracotta potPots3$12.50Shipped$37.50
410033 Mar 2026Priya RamanSnake plantPlants2$22.00Shipped$44.00
510044 Mar 2026Tomás RuizWatering canTools1$18.00Pending$18.00
610055 Mar 2026Elif DemirFernPlants4$9.50Shipped$38.00
710065 Mar 2026Mara OkaforPotting mixSoil2$7.25Returned$14.50
810076 Mar 2026Kenji MoriPruning shearsTools1$24.00Shipped$24.00
910087 Mar 2026Ines VargaCeramic potPots2$19.00Pending$38.00
1010098 Mar 2026Jonas LindMonsteraPlants1$34.00Shipped$34.00
1110109 Mar 2026Sofia RossiFernPlants6$9.50Shipped$57.00
12101110 Mar 2026Priya RamanPotting mixSoil5$7.25Shipped$36.25
13101211 Mar 2026Leo BrandtSnake plantPlants1$22.00Pending$22.00

L1 shows $229.00: the Totals of the six Plants orders, 34 + 44 + 38 + 34 + 57 + 22.

How the spreadsheet calculates it

Adds up the values in I2:I13 on the rows where E2:E13 is equal to "Plants".

  1. 1. SUMIF: Adds up the values in I2:I13 on the rows where E2:E13 is equal to "Plants".
    • range = `E2:E13`: the cells to check
    • criteria = `"Plants"`: what to match
    • sum_range = `I2:I13`: the cells to add for the matching rows

More SUMIF examples

  • =SUMIF(G2:G13,">20")Every price above 20 (no sum range: the tested cells are added).
  • =SUMIF($E$2:$E$13,L2,$I$2:$I$13)The total for the category in L2, ready to fill down a summary table.
  • =SUMIF(D2:D13,"*pot*",I2:I13)Totals of products with "pot" in their name.
  • =SUMIF(H2:H13,"<>Returned",I2:I13)Totals of every order that wasn't returned.
  • =SUMIF(B2:B13,">="&L1,I2:I13)Totals of orders on or after the date in L1.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Point criteria at a cell holding the category, so one formula fills down a summary table.
  • Lock range and sum_range with $ before filling down.
  • Keep range and sum_range the same size and starting on the same row.
  • Use "<>" to sum everything except one value: "<>Returned".

What SUMIF is used for

Sales per category or region, spend per budget category, hours per project, and summary tables where a list of categories sits next to one SUMIF each, the criteria pointing at the category cell.

Arguments

ArgumentRequiredWhat it is
rangeYesThe cells to test against the condition, such as the Category column E2:E13.
criteriaYesThe condition: a value ("Plants"), a comparison in quotes (">20"), a cell (L2) or a wildcard ("pot").Watch out: A comparison with a cell needs &: ">"&L2, not ">L2".
sum_rangeNoThe cells to add, row for row with range. Left out, SUMIF adds the matching cells of range itself.Watch out: Microsoft documents that a sum_range of a different size is resized to match range from its first cell, which can quietly add the wrong cells.

Common mistakes

  • Putting the sum range first: in SUMIF it comes last.

  • Ranges of different heights: rows no longer line up.

  • Putting the cell inside the quotes: ">L1" compares with the letters L1, so nothing matches and the total is 0. Write ">"&L1.

  • Adding two SUMIFs to get "Plants and Shipped": that adds the two groups (an OR, counting some rows twice). For several conditions on the same row, use SUMIFS.

In Google Sheets

Google Sheets' SUMIF takes the same three arguments, written SUMIF(range, criterion, [sum_range]), with the same optional sum range.

Errors you may see with SUMIF

  • #VALUE!: Criteria longer than 255 characters, or ranges in another workbook that's closed (Microsoft's SUMIF troubleshooting page).
  • #SPILL!: A whole range given as criteria (E2:E13 instead of one cell) returns one total per value in dynamic-array Excel and can spill into filled cells. How to fix it.

Questions

Why does SUMIF return 0?

Usually the criteria doesn't match exactly (a typo, a trailing space, singular vs plural) or the sum range holds text. SUMIFS returns 0 walks through each cause; they apply to SUMIF too.

How do I sum if a cell contains a word?

Use wildcards: =SUMIF(D2:D13,"*pot*",I2:I13) adds the totals of every product with "pot" anywhere in its name. ? stands for exactly one character.

How do I sum values greater than a number?

Put the comparison in quotes and leave out sum_range to add the tested cells themselves: =SUMIF(G2:G13,">20") adds every price above 20.

Should I use SUMIF or SUMIFS?

SUMIFS does everything SUMIF does and takes more conditions, with the sum range first. Many people use SUMIFS everywhere for one order of arguments. See SUMIF vs SUMIFS.

Sources

Official documentation the facts on this page were checked against.

Practise SUMIF on a live sheet

Lesson 18, SUMIF and criteria (Unit 5, Conditional totals), has 4 graded exercises, checked instantly, with steps and hints when you're stuck. Pro