Learn Excel
EN
Sets how numbers, dates and formulas look, so everything works just like your own Excel.

Home › Excel functions › SUMIF

SUMIF Formula in Excel: How to Use It, with Examples

The SUMIF formula adds up the numbers in a range that meet a condition. Total sales for one region, expenses above a certain amount, hours per employee: if you need a sum with a filter, SUMIF is the function.

In this guide
  1. SUMIF syntax
  2. Basic example
  3. Try it yourself
  4. Types of criteria
  5. Criteria in a cell
  6. Several values in one column
  7. Blank cells, * and ?
  8. SUMIFS: multiple criteria
  9. Common mistakes
  10. More SUMIF examples
  11. Keep learning
  12. FAQ

SUMIF syntax

=SUMIF(range, criteria, [sum_range])
ArgumentWhat it means
rangeThe cells to check against the condition.
criteriaThe condition, such as "North", ">=800" or a cell like F2.
sum_range
(optional)
The cells to add up. Leave it out to add up the cells in range itself.

Basic example: sales per region

ABC
1RegionRepSales
2NorthAnna1,200
3SouthBen800
4NorthChris950
5EastDana450
6SouthAnna700
=SUMIF(A2:A6, "North", C2:C6)

Excel checks each cell in A2:A6. Where it says "North" (rows 2 and 4), it adds the sales from column C on the same row: 1,200 + 950 = 2,150.

The range and sum_range should be the same size and start on the same row, so each region lines up with its own sales figure.

SUMIF practice: try it yourself

Reading is one thing, typing it is another. Build the formula below step by step: the tips tell you what to type next, and you can click or drag across cells to add them, just like in Excel.

Task: Add up everything spent on "Food" in E2: =SUMIF(B2:B7,"Food",C2:C7)

Types of criteria

You wantFormulaResult
Exact text=SUMIF(A2:A6, "South", C2:C6)1,500
Everything except=SUMIF(A2:A6, "<>North", C2:C6)1,950
Numbers of at least 800=SUMIF(C2:C6, ">=800")2,950
Text starting with "A"=SUMIF(B2:B6, "A*", C2:C6)1,900
Non-empty cells=SUMIF(B2:B6, "<>", C2:C6)4,100

A few rules: conditions with an operator go between quotes (">=800"). In the third example there's no sum_range, so SUMIF adds up the values in C2:C6 itself. The wildcard * stands for any number of characters and ? for exactly one.

Put the condition in a cell

Hard-coded text works, but a cell reference lets you change the condition without editing the formula. With "North" in F2:

Comparison operators: what to type

TypeMeans
=is equal to
>greater than
<less than
>=greater than or equal to: first >, then =
<=less than or equal to: first <, then =
<>not equal to: first <, then >

Always two separate keys, never a special symbol. In criteria, put the operator and the value together inside quotes, such as ">=500" or "<>Paid" as the condition.

=SUMIF($A$2:$A$6, F2, $C$2:$C$6)

To combine an operator with a cell, join them with &. With 800 in F3, this adds all sales of at least 800:

=SUMIF(C2:C6, ">="&F3)

Writing ">=F3" inside the quotes doesn't work: Excel would look for the literal text "F3".

Sum several values from the same column

Need the total for North and East together? Put the values you want in a small list, for example North in F2 and East in F3, and give SUMIF the whole list as the condition:

=SUMPRODUCT(SUMIF(A2:A6, F2:F3, C2:C6))

SUMIF now returns one total per value in the list (2,150 for North, 450 for East) and SUMPRODUCT adds them up: 2,600. To add a region, type it under the list and extend F2:F3. In Excel 365 =SUM(SUMIF(…)) works too; SUMPRODUCT also works in older versions without Ctrl+Shift+Enter.

Blank cells and a literal * or ?

To add up the sales of rows where no rep has been filled in yet, use empty quotes as the condition:

=SUMIF(B2:B6, "", C2:C6)

This also includes cells with a formula that returns "". Only want cells that are truly empty? Use "=" as the condition. The opposite, rows where column B is filled in, is "<>" from the table above.

Because * and ? are wildcards, the condition "A?12" also matches A112 and AB12. With product codes in column A and amounts in column B, put a tilde before the character to look for the character itself:

=SUMIF(A2:A100, "A~?12", B2:B100)

SUMIFS: multiple conditions

When you need more than one condition, use SUMIFS. Note that the order of the arguments is different: the range to add up comes first.

=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

Anna's sales in the South region:

=SUMIFS(C2:C6, A2:A6, "South", B2:B6, "Anna")

Only row 6 meets both conditions, so the result is 700. All conditions in SUMIFS must be true (AND logic). Many people use SUMIFS even for a single condition, so they only have to remember one argument order.

Common SUMIF mistakes

  • The result is 0. The criteria don't match anything. Check for extra spaces, or numbers stored as text in the sum range (text is ignored).
  • The total is off. range and sum_range have different sizes or start on different rows, so the values don't line up.
  • An operator with a cell doesn't work. Use ">"&F3, not ">F3".
  • Arguments in the wrong order in SUMIFS. In SUMIFS the sum range comes first; in SUMIF it comes last.

More SUMIF examples

Copy a formula and change the ranges to match your own data.

What you wantFormula
Sum only where column A is filled in=SUMIF(A2:A100, "<>", B2:B100)
Sum only the positive numbers=SUMIF(B2:B100, ">0")
Sum where column A contains the text in E1=SUMIF(A2:A100, "*"&E1&"*", B2:B100)
Sum from another sheet=SUMIF(Sheet2!A:A, E1, Sheet2!B:B)
Sum amounts with a date before today=SUMIF(C2:C100, "<"&TODAY(), B2:B100)

Frequently asked questions

What's the difference between SUMIF and SUMIFS?

SUMIF handles one condition; SUMIFS handles one or more. The argument order also differs: SUMIFS starts with the range to add up.

Is SUMIF case-sensitive?

No. "north", "North" and "NORTH" are all treated as the same.

How do I sum with an OR condition?

Add two SUMIFs together: =SUMIF(A2:A6, "North", C2:C6) + SUMIF(A2:A6, "South", C2:C6) totals both regions.

Can SUMIF sum between two dates?

Use SUMIFS with two conditions on the same date column: =SUMIFS(C2:C100, A2:A100, ">="&F1, A2:A100, "<="&F2), with the start date in F1 and the end date in F2.

How do I use SUMIF with another sheet?

Put the sheet name before both ranges: =SUMIF(Sheet2!A:A, E1, Sheet2!B:B). Easiest: start typing the formula, click the other sheet tab and select the range; Excel adds the sheet name for you.

Why does SUMIF return 0?

Usually one of three things: the numbers are stored as text, the condition doesn't match exactly (extra spaces, a typo), or the ranges are in the wrong order. The order is: the range you test, the condition, then the range you add up.

What happens if sum_range is a different size from range?

Excel gives no error. It takes the first cell of sum_range and makes it as large as range. =SUMIF(A2:A6, "North", C2:C3) therefore still adds up C2 and C4 and returns 2,150. If the sum range starts on the wrong row, for example C3:C7, everything shifts one row and you get 800 + 450 = 1,250 without a warning. So always make both ranges the same size and start them on the same row.

Can SUMIF add up a row instead of a column?

Yes, it works the same way across. With the labels Budget and Actual alternating in B1:M1 and the amounts in B2:M2, =SUMIF(B1:M1, "Actual", B2:M2) adds up only the Actual columns. Both ranges must be rows of the same width.

Can I use whole columns, like A:A?

Yes: =SUMIF(A:A, "North", C:C) picks up new rows automatically and isn't noticeably slower, because Excel only checks the used part of the sheet. Just don't put the formula in column A or C itself, or you'll get a circular reference.