Skip to content

All-Access: every lesson, no ads. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month, billed yearly. Free to start. Cancel any time

See plans
All-Access, no ads: every lesson, course and template. $8.25€8.25US$8.25$4.08US$4.08$2.41US$2.41₹224.91MX$74.91 a month. + GST at checkoutSee the plans →

Functions

SUMIF Function in Excel: Sum If Text, Numbers, Dates

By the LogicExcel Editorial Team16 min read3,048 wordsPractice this

SUMIF adds up only the numbers that pass a test. Write =SUMIF(A2:A11,"North",D2:D11) and Excel looks down A2:A11 for the word North, then adds the matching amounts from D2:D11. The pattern is always range, criteria, sum_range: where to look, what to look for, and what to add.

Try this now

The SUMIF function returns the sum of numbers which meet a certain criteria. Find the total value of all properties which cost less than $500,000 in C2:C7. Notice that the comparison operator needs to be inside quotes.
ABCDEF
1AddressCityValue (thousands)Units
2123 Balboa AveSan Diego4001
3999 Main StSan Francisco6002
4456 Ave ALos Angeles4501
5555 La Jolla BlvdSan Diego6504
6999 Ave ELos Angeles3503
7111 Ave ALos Angeles4002
F1fx

You are typing into F1. Refer to the cells that hold the data.

No key for < or > on your keyboard? Use these:

Continue the full lesson →

Ready to practice?

Apply what you just learned with interactive exercises.

Start Lesson 29

This page walks through sum if formulas for text, numbers, dates and wildcards, shows where SUMIF stops, and lists the mistakes that give a wrong total.

TL;DR

  • The syntax is =SUMIF(range, criteria, [sum_range]). The first range is tested, the last range is added.
  • Text criteria go in quotes: "North". They are not case sensitive, so "north" matches too.
  • Number and date tests put the operator inside the quotes: ">1000", "<=900", "<>Paint". To use a cell value in the test, join with an ampersand: ">"&G2.
  • Wildcards work in text criteria. "North*" matches North and North East, and "*ent*" matches anything containing ent.
  • SUMIF handles one condition. For "sum if this AND that", move to SUMIFS, where the sum range comes first.
  • If the answer is 0 and you expected a number, check for a trailing space, a typo or text-formatted numbers before blaming the formula.

Table of Contents

The sample data used on this page

The sheet is an order log for a building-supplies wholesaler. Columns A to D hold the orders. Columns F to H are three control cells that later examples read, so you can change the test without editing the formula.

ABCDEFGH
1RegionProductOrder dateAmountRegionMin amountFrom
2NorthPaint2026-01-051200South10002026-03-01
3SouthTiles2026-01-18950
4NorthTiles2026-02-02780
5North EastPaint2026-02-141500
6SouthPaint2026-03-03640
7NorthCement2026-03-212100
8EastTiles2026-04-09870
9SouthCement2026-04-251830
10NorthPaint2026-05-12910
11North EastCement2026-05-301650
All ten orders add up to 12430. The order dates are real Excel dates, not text. Note that "North East" is its own region, which matters for the wildcard examples.

SUMIF syntax and arguments

=SUMIF(range, criteria, [sum_range])

ArgumentRequired?What it does
rangeRequiredThe cells Excel tests against the criteria.
criteriaRequiredThe test. It can be text, a number, an expression such as ">1000", a wildcard pattern or a cell reference.
sum_rangeOptionalThe cells to add when the test passes. If you leave it out, Excel adds the cells in range itself.
Three rules save most of the pain.
  1. Text and operators live in quotes. "North" and ">1000" are strings. A bare word like North is read as a name that does not exist. SUMIF then returns 0 with no error, so this mistake is easy to miss.
  2. The two ranges must line up. Row 4 of the test range is paired with row 4 of the sum range. Excel starts at the top-left cell of sum_range and uses the same shape as range, so a shorter sum range is stretched. Do not depend on that. Make both ranges the same size.
  3. Matching is not case sensitive. "north", "North" and "NORTH" all pass the same rows.

SUMIF examples, from one word to dates

Sum if a cell equals text

To total the North region:

=SUMIF(A2:A11,"North",D2:D11)

It returns 4990, which is 1200 + 780 + 2100 + 910. Excel checks A2 to A11 one by one, keeps rows 2, 4, 7 and 10, and adds the matching amounts in column D. The row for "North East" does not match, because a plain text criterion must match the whole cell. Writing "north" in lower case gives the same 4990.

Use a cell as the criteria

Typing the region inside the formula means editing the formula every time. Point at a cell instead. F2 holds South:

=SUMIF(A2:A11,F2,D2:D11)

It returns 3420 (950 + 640 + 1830). Change F2 to East and the same formula returns 870. The criteria is a plain cell reference, so no quotes or ampersand are needed for an exact match.

Sum if greater than, less than or equal to

For a number test, put the operator and the number together in quotes. Large orders over 1000:

=SUMIF(D2:D11,">1000")

It returns 8280, which is 1200 + 1500 + 2100 + 1830 + 1650. There is no third argument here. With no sum_range, SUMIF adds the cells it tested, which is exactly what you want when the test and the total are the same column.

Small orders of 900 or less:

=SUMIF(D2:D11,"<=900")

It returns 2290 (780 + 640 + 870). The operators are >, <, >=, <=, = and <>.

Sum if greater than a value stored in a cell

When the threshold lives in a cell, join the operator to it with an ampersand. G2 holds 1000:

=SUMIF(D2:D11,">"&G2)

It returns 8280, the same as typing 1000 in the formula. The quotes hold only the operator, and the ampersand glues on whatever G2 contains. This is how you build a report where someone changes a threshold and every total updates. A common slip is writing ">G2" with everything in quotes, which compares against the text "G2" and not the number in the cell.

Sum if not equal to something

Use <> to exclude. To total every product except Paint:

=SUMIF(B2:B11,"<>Paint",D2:D11)

It returns 8180. Paint accounts for 1200 + 1500 + 640 + 910 = 4250, and 12430 minus 4250 is 8180. Do not put a space after the operator. "<> Paint" means "not equal to a text that starts with a space", and every row passes.

Sum if a cell contains text or starts with it

Wildcards let one criterion match many cells. * stands for any run of characters, including none, and ? stands for exactly one character. To total every region that starts with North:

=SUMIF(A2:A11,"North*",D2:D11)

It returns 8140: the 4990 from North plus the 3150 from North East. Compare that with =SUMIF(A2:A11,"North",D2:D11), which stops at 4990. For regions that end in East:

=SUMIF(A2:A11,"*East",D2:D11)

It returns 4020, which is East (870) plus North East (3150). To sum if the product name contains a fragment, wrap the fragment in stars:

=SUMIF(B2:B11,"*ent*",D2:D11)

It returns 5580. Only Cement contains "ent", and its three orders are 2100, 1830 and 1650. If you need to match a real star or question mark, type a tilde in front of it. Our wildcard characters guide goes through all three symbols.

Sum if the date is on or after a date

Dates are numbers, so the same operators work. Build the date with DATE so that regional date settings cannot break the formula:

=SUMIF(C2:C11,">="&DATE(2026,3,1),D2:D11)

It returns 8000, the six orders from 1 March onward (640, 2100, 870, 1830, 910, 1650). If the start date sits in H2, use it directly:

=SUMIF(C2:C11,">="&H2,D2:D11)

That also returns 8000.

SUMIF has one condition, so a date window needs two SUMIFs subtracted. March alone is the sum from 1 March, less the sum after 31 March:

=SUMIF(C2:C11,">="&DATE(2026,3,1),D2:D11)-SUMIF(C2:C11,">"&DATE(2026,3,31),D2:D11)

It returns 2740, which is the two March orders of 640 and 2100. This works, but it is the moment to switch to SUMIFS, which takes both date limits in one formula.

Sum if a cell is not blank, or is blank

Use "<>" as the whole criterion to test for any non-empty cell, and "=" to test for an empty one. In an order log, that is a quick way to total only the rows where a column was filled in. Cells that look blank but hold a space or an empty string from a formula do not behave as empty, which is why a blank test sometimes surprises people.

How to sum if with two conditions or an OR

Two conditions can mean AND or OR, and the answer depends on which you need.

AND (both must be true). SUMIF cannot do this. Use SUMIFS. Paint orders in the North region:

=SUMIFS(D2:D11,A2:A11,"North",B2:B11,"Paint")

It returns 2110 (1200 + 910). Notice that the sum range moves to the front. That reordering is the single biggest source of errors when people move from SUMIF to SUMIFS. The SUMIFS guide covers it in depth.

OR (either is enough). Add two SUMIFs:

=SUMIF(A2:A11,"North",D2:D11)+SUMIF(A2:A11,"South",D2:D11)

It returns 8410, the 4990 for North and the 3420 for South. If you have many values to test, an array constant keeps the formula shorter:

=SUM(SUMIF(A2:A11,{"North","South"},D2:D11))

It also returns 8410. SUMIF runs once for each item in the curly brackets and returns two totals, and SUM adds them. In older versions of Excel, the array constant version works as written.

SUMIF compared with SUMIFS and other options

ToolHandlesExample on this dataWatch for
SUMIFOne condition=SUMIF(A2:A11,"North",D2:D11) returns 4990Cannot do AND
SUMIFSMany conditions, AND logic=SUMIFS(D2:D11,A2:A11,"North",B2:B11,"Paint") returns 2110Sum range comes first
SUMPRODUCTAny logic you can write as a test=SUMPRODUCT((A2:A11="North")*(D2:D11)) returns 4990Text in the sum range gives #VALUE!
SUMNo condition=SUM(D2:D11) returns 12430Adds everything
PivotTableMany totals at onceNo formulaNeeds a refresh when data changes
Use SUMIF when there is one test and the layout is a simple list. Use SUMIFS the moment there are two. Use SUMPRODUCT when the test is something SUMIF cannot express, such as comparing two columns row by row. For a many-way breakdown, a pivot table is faster to build than a stack of SUMIFs. To add everything with no test, see the plain SUM guide. To count rows instead of adding them, the matching tool is COUNTIF.

Which Excel versions have SUMIF

SUMIF has been in Excel for decades, so it works in every desktop version, in Excel for the web and in Excel for Mac. The wildcards and operators behave the same everywhere. SUMIFS arrived in Excel 2007. The array constant version in the OR example needs no special entry in any version, because SUM does the final addition.

SUMIF errors and wrong totals

What you seeCauseFix
0 with no errorThe criteria has no quotes, as in =SUMIF(A2:A11,North,D2:D11). Excel looks for a name that does not exist and matches nothingWrite "North"
0 when you expect a totalThe text does not match exactly, for example a trailing space: =SUMIF(A2:A11,"North ",D2:D11) returns 0Remove the space from the formula or the data (see the TRIM guide)
#VALUE!The criteria is longer than 255 charactersShorten it, or switch to SUMPRODUCT
Total is too smallNumbers in the sum range are stored as text, so they are not addedConvert them to real numbers
Total is too bigA wildcard such as "North*" also caught North EastUse the exact name, or a different pattern
Wrong rows addedrange and sum_range are different sizes or start in different rowsMake them the same height and start on the same row
A formula that will not enterThe operator is outside the quotes, as in =SUMIF(D2:D11,>1000)Put it inside: ">1000"
A fast diagnostic is to replace the SUMIF with a plain =SUM(D2:D11) and check it matches the column you expect. If that total is wrong, the problem is the data, not the criteria.

What learners get wrong

Between 26 September and 3 November 2026, learners made 9,036 first attempts across our SUMIF lesson, and 51.5% were right. These counts are first checks of a screen in a page view, not people. The stored wrong answers show where the trouble is.

Mixing up the three arguments. The hardest screen asks for the total value of properties that do not have 3 units. It had 761 first attempts and only 18.9% were right. The accepted answer is =SUMIF(D2:D7,"<>3",C2:C7): test the units column, add the value column. The commonest wrong answer, 69 times, was =SUMIF(D2:D7,"<>3"). With no third argument SUMIF adds the units column itself, so it answers a different question. Another 34 swapped the columns: =SUMIF(C2:C7,"<>3",D2:D7). A third group used "<3" instead of "<>3", as in =SUMIF(D2:D7,"<3",C2:C7) (32 times). A bare < means "less than 3", not "not equal to 3".

Forgetting quotes, or the order. Finding the units in San Diego had 1,177 first attempts and 30.4% were right. The accepted answer is =SUMIF(B2:B7,"san diego",D2:D7). Learners typed =SUMIF(B2:B7,sandiego,D2:D7) 63 times. It has no quotes and no space, so Excel treats it as a name. Another 51 wrote =SUMIF(D2:D7,"San Diego"), which tests the number column for the word San Diego and finds nothing. Another 43 added the wrong column, =SUMIF(B2:B7,"San Diego",C2:C7). Say the three parts out loud before typing: where to look, what to find, what to add.

Putting two criteria into SUMIF, or a star on the wrong side. The wildcard screen asks for the units in both San Francisco and San Diego and had 775 first attempts, with 37.5% right. The accepted answer is =SUMIF(B2:B7,"san *",D2:D7). Eighteen first attempts were =SUMIF(B2:B7,"San Francisco","San Diego",D2:D7), which gives SUMIF a fourth argument it does not have. Twenty-four first attempts were =SUMIF(B2:B7,"*San",D2:D7), with the star at the front, so Excel looks for cells that end in San. A star after the shared start of the words is what captures both cities.

A space after the operator. On the "not in San Diego" screen, 721 first attempts were 39.9% right. The accepted answer is =SUMIF(B2:B7,"<>san diego",C2:C7). Eighteen first attempts wrote =SUMIF(B:B,"<> San Diego",C:C) with a space after the operator. The space becomes part of the text being compared, so nothing is excluded. Another 13 summed the wrong column, =SUMIF(B2:B7,"<>San Diego",D2:D7).

Our SUMIF practice lesson had 2,602 first attempts and 70.1% right. Its hardest screens asked for a number, and some learners typed the formula where the screen wanted the figure it returns, for example =SUMIF(C:C,"*ponds",D:D). Run the formula, then enter what it shows.

A worked job: a regional sales summary

The sales manager wants a total for every region on one small table, and a check that nothing is missing. Use the order log above, and put the four regions in F2 to F5.

  1. List the regions. Type North, South, East and North East into F2:F5. These are exact names, so this is a list of whole-cell matches.
  2. Add the formula once, with locked ranges. In G2 enter =SUMIF($A$2:$A$11,F2,$D$2:$D$11) and press Enter. The dollar signs lock the data ranges so they do not slide when you copy the formula down. The absolute reference guide explains why.
  3. Fill down to G5. Each row changes only the criteria cell (F3, F4, F5). The same formula in G3 uses F3 and returns 3420 for South. In G5 it uses F5 and returns 3150 for North East.
  4. Check the total. In G6 enter =SUM(G2:G5). It should equal =SUM(D2:D11). If the summary comes out lower, a region is missing from the list or is spelled differently in the data.
The finished summary:
FG
1RegionTotal
2North4990
3South3420
4East870
5North East3150
6Total12430
North and North East together are 8140, which matches the wildcard example earlier. Step 4 is the one that catches typing mistakes, so do not skip it.

Practice SUMIF in the browser

The exercise above this article is Practice Lesson 29. Type the SUMIF formula there and the lesson checks it on the spot. When that feels easy, try Practice Lesson 60, which uses a longer table and asks for the number the formula returns. You can start free on the site, then a pass opens the rest. For the next step, move on to the COUNTIF function and then SUMIFS. SUMIF also does the sums in a personal project such as a wedding budget in Excel, where it totals what you have agreed to pay by category.

FAQ

What does the SUMIF function do in Excel?

SUMIF adds the numbers in one range when the matching cells in another range pass a test. You give it where to look, what to look for and what to add. For example, =SUMIF(A2:A11,"North",D2:D11) adds the amounts for North.

How do I sum if a cell contains text in Excel?

Put the text between stars so SUMIF matches anywhere in the cell: =SUMIF(B2:B11,"*ent*",D2:D11). Use "North*" for cells that start with a word and "*East" for cells that end with one. The matching is not case sensitive.

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

Put the operator and the number in quotes: =SUMIF(D2:D11,">1000"). If the number is in a cell, join it with an ampersand: =SUMIF(D2:D11,">"&G2). When the tested and added cells are the same column, you can leave out the third argument.

Can SUMIF sum with two conditions?

No. SUMIF takes one condition. Use SUMIFS for two or more, for example =SUMIFS(D2:D11,A2:A11,"North",B2:B11,"Paint"). The sum range comes first in SUMIFS, then each range and criteria pair. For an OR, add two SUMIFs.

Why does my SUMIF return 0?

Usually the criteria does not match the data exactly. Look for a trailing space, a spelling difference or a wildcard you forgot. Also check whether the numbers in the sum range are real numbers, because text numbers are skipped. Compare against =SUM of the same column.

Is SUMIF case sensitive?

No. "north", "North" and "NORTH" all match the same cells. If you need a case sensitive total, use SUMPRODUCT with the EXACT function, which compares letter case.

How do I sum if between two dates?

SUMIF has one condition, so subtract two SUMIFs, or use SUMIFS with a start and an end test. The subtraction version is =SUMIF(C2:C11,">="&DATE(2026,3,1),D2:D11)-SUMIF(C2:C11,">"&DATE(2026,3,31),D2:D11). It returns the March total in the sample data.

Sources

Keep going

Guides people read next.