What SUMIF does

SUMIF adds up the numbers on the rows that meet one condition, such as the sales for the North region or every invoice over 500. =SUMIF(B2:B7,"North",C2:C7) checks the regions in B2:B7 and adds the amount from column C on every row that says North.

It works with two columns side by side. One holds what you test, the region for example, and the other holds what you add, such as the amount. SUMIF goes down both together and adds the amount on every row where the region matches.

When the numbers you test are also the numbers you add, one range is enough: “add every amount over 500” needs only the amounts.

Syntax

=SUMIF(range, criteria, [sum_range])
Arguments in square brackets are optional; the rest are required.
rangeRequired
The cells to test against the condition, such as the region column B2:B7.
criteriaRequired
The condition: text in quotation marks ("North"), a comparison in quotation marks (">500"), a number, or a cell such as B9. Join an operator to a cell with &: ">"&E1.
sum_rangeOptional
The cells to add, such as the amounts in C2:C7, lined up row by row with range. Leave it out and SUMIF adds the cells in range itself.

Example: total sales for one region

Orders are in rows 2 to 7, with the region in column B and the amount in column C. The region to total is typed in B9.

The North rows hold 420, 180 and 350: 950 in total. In B10, =SUMIF(B2:B7,B9,C2:C7) returns 950.

Read it as: in B2:B7, find the rows that say what B9 says, and add their amounts from C2:C7. Type South in B9 and the total becomes 400.

Example: add only the large amounts

To add every invoice over 500, test the amounts themselves and leave out the third argument:

640 + 980 + 510 = 2,130. An invoice of exactly 500 wouldn't count; ">=500" would include it. In B9, =SUMIF(B2:B8,">500") returns 2,130.

Not blank, not equal to and other conditions

The condition is the second argument. Text and comparisons go in quotation marks, with the operator inside them:

ConditionAdds the rows where the tested cell
"North"says North, in any mix of capitals
"<>North"says anything else, blank cells included
"<>"isn’t blank
""is blank
">500"holds a number over 500
">="&E1holds a number at least as big as the one in E1

In a full formula, =SUMIF(B2:B7,"<>",C2:C7) adds the amounts on every row that has a region filled in.

SUMIF vs SUMIFS

SUMIF takes one condition, and the range to add comes last, where you can leave it out. SUMIFS takes up to 127 conditions and starts with the range to add. With a single condition they give the same total: on the orders above, =SUMIF(B2:B7,"North",C2:C7) and =SUMIFS(C2:C7,B2:B7,"North") both return 950. Switch to SUMIFS when a row has to pass a second test, such as one region in one month. To count the matching rows, use COUNTIF.

Common mistakes

  • range and sum_range should cover the same rows, B2:B7 with C2:C7. When they don’t, SUMIF lines them up from the first cell and quietly adds the wrong rows.
  • SUMIF puts the range to add last and SUMIFS puts it first. Mixing up the order can make the total come out as 0.
  • ">E1" compares with the letters E1. To use the value in E1, join it on: ">"&E1.
  • “North” and “North ” with a trailing space are different values to SUMIF, and so are “N. America” and “North America”. Clean the column the test runs on: TRIM removes the extra spaces.

Frequently asked questions

How do I use SUMIF with multiple criteria?

SUMIF checks one condition. For two or more, use SUMIFS: =SUMIFS(D2:D50,B2:B50,"North",C2:C50,"Desk") adds the amounts in column D on the rows that are both North and Desk. The free lesson Total by several conditions with SUMIFS lets you practice it.

Why is my SUMIF returning 0?

First check that the condition matches: =COUNTIF(B2:B7,"North") shows how many rows it finds, and trailing spaces or typos in the data make that 0. If the count is right, check the order, with the range to add last, and look for amounts stored as text, which SUMIF skips.

How do I use SUMIF when a cell contains certain text?

Use wildcards. =SUMIF(A2:A50,"*desk*",C2:C50) adds the amounts on every row whose product name contains “desk”. An asterisk stands for any characters, a question mark for one.

Is SUMIF case-sensitive?

No. “north” and “North” match the same rows.

Can I use a date as the condition?

Yes, compare with a date in a cell: =SUMIF(A2:A50,">="&E1,C2:C50) adds the amounts dated on or after the date in E1.