Sums and Counts

How to Use the SUMIF Function in Excel

Learn how SUMIF adds up values that meet one condition in Excel, with the syntax, examples for text, numbers and dates, and common reasons it returns 0.

On this page
  1. Use SUMIF to add up values that match one condition
  2. A simple example
  3. Use comparison operators for numbers
  4. Use SUMIF with dates
  5. Use wildcards for partial matches
  6. Why SUMIF returns 0 or the wrong total
  7. When one condition is not enough

Use SUMIF to add up values that match one condition

SUMIF adds the numbers in one range when the matching cells in another range meet a condition. The syntax is:

=SUMIF(range, criteria, [sum_range])
  • range is the cells to test against the condition.
  • criteria is the condition, such as “East”, “>500” or a cell reference.
  • sum_range is optional. It holds the numbers to add. If you leave it out, Excel adds up the cells in range itself.

A simple example

Suppose column A lists regions and column B lists sales:

A (Region) B (Sales)
East 1200
West 850
East 430
North 600
East 275

To total the East sales, use:

=SUMIF(A2:A6, "East", B2:B6)

The result is 1905, which is 1200, 430 and 275 added together.

Text criteria need quotation marks in the formula. If you type East without them, Excel looks for a named range called East and returns #NAME? when it can’t find one.

You can also put the criteria in a cell. If D1 holds the word East, use =SUMIF(A2:A6, D1, B2:B6) and you get the same result. Change the word in D1 and the total follows.

Use comparison operators for numbers

Operators such as >, <, >=, <= and <> work inside the criteria. To add up the sales above 500 in column B:

=SUMIF(B2:B6, ">500")

This returns 2650, which is 1200, 850 and 600 added together. Leaving out sum_range means Excel adds up the cells that meet the condition in the same column.

To compare against a value in a cell, join the operator and the cell with an ampersand: =SUMIF(B2:B6, ">="&D2), where D2 holds the threshold.

Use SUMIF with dates

Dates are numbers in Excel, so they work as criteria with a comparison operator. To total sales dated on or after January 1, 2026, with the dates in column A and the sales in column B:

=SUMIF(A2:A100, ">="&DATE(2026,1,1), B2:B100)

The ampersand joins the operator and the date value.

Use wildcards for partial matches

An asterisk (*) matches any run of characters, and a question mark (?) matches exactly one character. To add up every region whose name ends in “ast”:

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

In the sample table, that returns 1905. Matching is not case-sensitive, so “east” and “East” are treated as the same.

Why SUMIF returns 0 or the wrong total

  • Numbers stored as text. Text in the sum range is skipped, so those sales add nothing. Convert the numbers first.
  • Extra spaces. “East “ with a trailing space doesn’t match “East”. Clean the data, or use TRIM on the cells.
  • Mismatched ranges. Start both ranges on the same row and make them the same height. Excel doesn’t warn you when they differ, and it adds up a block the same size as the criteria range, starting from the top-left cell of sum_range.
  • Missing quotation marks. Text criteria typed without quotes returns #NAME?.

For fixing numbers stored as text, how to convert text to number in excel covers the options.

When one condition is not enough

SUMIF handles only one test. If the total also depends on a second condition, such as product as well as region, the approach changes to SUMIFS, which takes the sum range first. The details are in sumifs with multiple criteria in excel. Counting rows instead of adding them follows the same pattern with COUNTIF, covered in how to use countif in excel.

The complete guide to sums and counts

How to Sum and Count in Excel
Read the guide

Keep exploring

Guides from other topics

All topics →