Skip to content

SUMIF

Adds the cells that meet one condition, such as every sale in a region or every amount over a limit.

Syntax

=SUMIF(, , )

Math and trigonometry

All versions of Excel.

Try it

Edit the formula in B9 or change the inputs. The sheet recalculates as you type.

B9
A
B
1
Region
Sales
2
North
1,200
3
South
800
4
North
950
5
East
600
6
South
700
7
North
400
8
9
North total
2,550

B9 =SUMIF(A2:A7,"North",B2:B7) returns 2550

How SUMIF works

SUMIF adds the values that meet a single condition. Use it for questions like "how much did the North region sell?" or "what is the total of all invoices over 700?".

How SUMIF works

SUMIF looks down the range one cell at a time and tests each against the criteria. When a cell passes, SUMIF adds the cell in the same position of sum_range. If you leave sum_range out, SUMIF adds the cells in range themselves, which is the usual choice when the condition is on the numbers: =SUMIF(B2:B9, ">700").

Writing criteria

  • A plain value matches exactly and ignores case: "north" finds "North".
  • An operator goes inside the quotes with the value: ">=500", "<100", "<>North".
  • * stands for any run of characters and ? for any single character: "Desk*" matches "Desk lamp" and "Desk chair". To search for a literal * or ?, put ~ in front of it.
  • To take the limit from a cell, join the operator to the cell with &: ">="&E2. Typing ">=E2" instead is a common slip, because Excel then compares against the text "E2".

The argument order differs from SUMIFS

In SUMIF the cells to add come last and are optional. In SUMIFS they come first and are required. Copying a formula between the two without moving the argument is a frequent source of wrong totals.

One condition only

SUMIF handles one condition. For two or more, for example region and month, use SUMIFS. For an OR condition across different columns, add two SUMIFs, or use SUMPRODUCT.

Where SUMIF fits

  • It is simpler than SUMIFS when you have one test, and the results are the same.
  • It is quicker to write than a pivot table, and it updates immediately when the data changes.
  • It ignores errors in sum_range only if those rows fail the condition. A matching row that holds #N/A makes the whole result #N/A.

Lock the ranges with dollar signs, as in $A$2:$A$9, when you copy a SUMIF down a list of regions.

Arguments

range
The cells to test against the condition, such as A2:A9. If you leave out sum_range, these cells are also the ones that get added.
criteria
The condition. A number or cell matches equal values, "North" matches text, and a string such as ">500", "<>North" or "Desk*" uses an operator or wildcard. To use a cell as the limit, join it on: ">"&E2.
sum_rangeoptional
The cells to add when the matching cell in range meets the condition, such as B2:B9. Give it the same size as range. If it is a different size, Excel resizes it from its top-left cell to match range.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Total for one region

B9 =SUMIF(A2:A7,"North",B2:B7)

Result: 2550

SUMIF tests A2:A7 for "North" and adds the matching cells of B2:B7: 1,200 + 950 + 400.

B9
A
B
1
Region
Sales
2
North
1,200
3
South
800
4
North
950
5
East
600
6
South
700
7
North
400
8
9
North total
2,550

B9 =SUMIF(A2:A7,"North",B2:B7) returns 2550

Example 2

Add the values that pass a test (no sum_range)

D2 =SUMIF(B2:B7,">700")

Result: 2950

The condition is on the sales themselves, so sum_range is left out. The cells that pass, 1,200, 800 and 950, are the ones added.

D2
A
B
C
D
1
Region
Sales
Sales over 700
2
North
1200
2950
3
South
800
4
North
950
5
East
600
6
South
700
7
North
400

D2 =SUMIF(B2:B7,">700") returns 2950

Example 3

Take the limit from a cell

E2 =SUMIF(B2:B7,">"&D2)

Result: 2950

The operator is joined to the cell with &. Change D2 and the total follows.

E2
A
B
C
D
1
Region
Sales
Limit
2
North
1200
700
3
South
800
4
North
950
5
East
600
6
South
700
7
North
400

E2 =SUMIF(B2:B7,">"&D2) returns 2950

Example 4

Wildcard on text

B8 =SUMIF(A2:A6,"Desk*",B2:B6)

Result: 9

"Desk*" matches any item that starts with Desk: 4 + 2 + 3.

B8
A
B
C
1
Item
Qty
2
Desk lamp
4
3
Desk chair
2
4
Floor lamp
5
5
Desk mat
3
6
Monitor arm
6
7
8
Desk items
9

B8 =SUMIF(A2:A6,"Desk*",B2:B6) returns 9

Example 5

Everything except one value

B9 =SUMIF(A2:A7,"<>North",B2:B7)

Result: 2100

"<>North" means not equal to North, so South and East are added: 800 + 600 + 700.

B9
A
B
1
Region
Sales
2
North
1200
3
South
800
4
North
950
5
East
600
6
South
700
7
North
400
8
9
Not North
2100

B9 =SUMIF(A2:A7,"<>North",B2:B7) returns 2100

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In E2, total the amounts for the category named in D2.

Answer in E2.

E2
A
B
C
D
E
1
Category
Amount
Category
Total
2
Travel
420
Travel
3
Software
310
4
Travel
185
Minimum
Total
5
Training
600
300
6
Software
95
7
Travel
260
8
Training
150

Common mistakes

  • Typing the cell reference inside the quotes, as in ">="&D2 written ">=D2", compares against the text "D2" and returns 0. Join the operator to the cell with &.
  • If you leave out sum_range and the condition is on a text column, SUMIF adds that text column and returns 0. Name the cells you want added.
  • Criteria are not case-sensitive and match whole cell contents. "North" does not match "North East" unless you write "North*".
  • A criteria string longer than 255 characters returns #VALUE!. Shorten it or use SUMPRODUCT.
  • Numbers stored as text don't match numeric criteria such as ">700". Convert them to real numbers first.

Questions people ask

What is the difference between SUMIF and SUMIFS?

SUMIF has one condition and puts the cells to add last. SUMIFS takes any number of conditions and puts the cells to add first. With one condition they give the same answer.

How do I use SUMIF with greater than a cell value?

Join the operator and the cell with an ampersand: `=SUMIF(B2:B9, ">"&E2)`. Writing `">E2"` doesn't work, because Excel reads E2 as text.

Can SUMIF check two columns?

No. Use SUMIFS for AND conditions, such as region and product. For OR across columns, add two SUMIF results or use SUMPRODUCT.

Does SUMIF ignore case?

Yes. "north" and "NORTH" both match "North". For a case-sensitive total, use SUMPRODUCT with EXACT.

How do I sum cells that contain a word?

Put wildcards either side of the word: `=SUMIF(A2:A9, "*lamp*", B2:B9)` adds every row whose text contains "lamp".

Learn SUMIF in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.