Skip to content

SUMIF Function in Excel

Math · Updated

Purpose
Add up the numbers in a range that meet one condition.
Returns
A number. 0 if no cell meets the condition.
Syntax
fx=SUMIF(range, criteria, [sum_range])
Works in
Every version of Excel · Microsoft 365 · Google Sheets · LibreOffice Calc

Arguments

ArgumentRequiredWhat it is
rangeYesThe cells to test against the condition.
criteriaYesThe condition. A number, a cell reference, or text in double quotes such as "West" or ">100".
sum_rangeNoThe cells to add up. Left out, SUMIF adds up the cells in range itself.

Example: total sales for one region

Each cell in column A is compared with the region in E2. For every row that matches, the sales figure from column C is added to the total.

F2fx=SUMIF(A2:A7, E2, C2:C7)
ABCDEF
1RegionRepSalesRegionTotal
2EastDana1200West3050
3WestOmar950
4EastLena780
5NorthRaj1430
6WestInes1310
7WestKofi790

Build your SUMIF formula

Fill in the fields with your own cells. The formula updates as you type.

Text, a number, a cell, or a comparison such as >100 or <>Done.
Leave empty to add up the checked column itself.
Your formula
E2fx=SUMIF(A2:A20, "East", C2:C20)

Adds up the values in C2:C20 for every row where A2:A20 meets the condition "East".

Paste the formula into cell E2 or any empty cell. The coloured parts match the coloured fields. Using a different list separator? Replace the commas with semicolons.

How SUMIF works

SUMIF walks down the test range one cell at a time. Each cell is checked against the criteria. When a cell passes, the cell in the same position of the sum range is added to the total.

If you leave out the sum range, SUMIF adds up the tested cells themselves. That is the short form for conditions on the numbers you are adding:

=SUMIF(C2:C7, ">1000")

With the example data above this returns 3940, the total of the three sales figures over 1000.

Writing the criteria

The criteria argument is where most SUMIF mistakes happen. A plain number or a cell reference needs no quotes. Text and anything with a comparison operator must be inside double quotes.

Criteria Matches
"West" Cells equal to West. Case is ignored.
100 Cells equal to 100.
">100" Numbers greater than 100.
"<=100" Numbers less than or equal to 100.
"<>Done" Cells that are not equal to Done.
"*east*" Text that contains “east” anywhere.
"A?" Text that is A followed by exactly one character.
E1 Cells equal to the value in E1.
">="&E1 Numbers greater than or equal to the value in E1.
"" Blank cells.
"<>" Cells that are not blank.

To compare against a cell, keep the operator in quotes and join the reference with &. Writing ">E1" does not work, because the cell name inside the quotes is read as text.

The wildcards are * for any run of characters and ? for one character. To find a real asterisk or question mark, put a tilde in front of it: "~*".

More examples

These use the example data above, with regions in column A, reps in column B and sales in column C.

Everything except one region

=SUMIF(A2:A7, "<>West", C2:C7)

returns 3410, the total for the East and North rows.

Names that start with a letter

=SUMIF(B2:B7, "L*", C2:C7)

returns 780, the sales for Lena, the only rep whose name starts with L.

At or above a threshold held in a cell

=SUMIF(C2:C7, ">="&E5)

returns the total of every sales figure that is at least the number typed in E5.

From a date onward

=SUMIF(A2:A100, ">="&DATE(2026,1,1), C2:C100)

returns the total of column C for rows whose date in column A is 1 January 2026 or later.

Tips

  • Keep the test range and the sum range the same size and on the same rows. If they differ, Excel sizes the sum range from its top-left cell, and the pairing of rows can shift.
  • Lock the ranges with dollar signs ($A$2:$A$7) before copying the formula down a list of regions.
  • SUMIF ignores text in the sum range. A column of numbers stored as text adds up to 0.
  • Trailing spaces break exact text matches. “West “ with a space is a different value from “West”.
  • A condition such as "*" matches any cell that contains text, which is a quick way to total only the labelled rows.

SUMIF or SUMIFS

SUMIF handles one condition. SUMIFS handles one or more, and every condition must be true for a row to be added.

The two functions put their arguments in a different order, and mixing them up is a common error:

Function Order of arguments
SUMIF range, criteria, [sum_range]. The column to add up comes last.
SUMIFS sum_range, criteria_range1, criteria1, …. The column to add up comes first.

SUMIFS also works with a single condition, so some people use it everywhere and learn only one argument order. SUMIFS needs Excel 2007 or later. SUMIF works in every version.

To count matching rows and not add them up, use COUNTIF. To write a formula from a description in words, try the Excel formula generator.

Errors and fixes

ErrorWhy it happensFix
0 resultNothing matched, often because of extra spaces in the cells, or the numbers in the sum range are stored as text.Remove stray spaces with TRIM and convert text numbers to real numbers.
#VALUE!The formula refers to a range in another workbook that is closed.Open the other workbook, or copy the data into the same file.
Wrong totalThe sum range starts on a different row from the test range, so each test is paired with the wrong row.Give both ranges the same first and last row.
Wrong total or 0The arguments are in SUMIFS order, with the column to add up first.In SUMIF the test range comes first and the sum range comes last.

Questions

Can SUMIF use multiple criteria?

No. SUMIF takes one condition. For two or more conditions that must all be true, use SUMIFS. For either of two values in the same column, add two SUMIF formulas together: =SUMIF(A2:A7, "East", C2:C7) + SUMIF(A2:A7, "West", C2:C7).

Is SUMIF case-sensitive?

No. "west", "West" and "WEST" are treated as the same value.

Why does SUMIF return 0?

Either no cell met the condition or the cells being added are text. Check for trailing spaces in the test column, and check that the numbers are real numbers. Text numbers are usually left-aligned and SUMIF skips them.

How do I use SUMIF with dates?

Join a comparison operator to a date: =SUMIF(A2:A100, ">="&DATE(2026,1,1), C2:C100) adds the rows dated 1 January 2026 or later. You can also point at a cell that holds a date: ">="&E1.

How do I sum cells that contain certain text?

Use wildcards. =SUMIF(A2:A100, "*east*", C2:C100) adds every row where column A contains "east" anywhere in the cell. An asterisk matches any text and a question mark matches one character.

What is the difference between SUMIF and SUMIFS?

SUMIF tests one condition and SUMIFS tests one or more. The argument order also differs. SUMIF is (range, criteria, sum_range) with the sum range last. SUMIFS is (sum_range, criteria_range1, criteria1, …) with the sum range first.

Related