Sum if Cell Contains Text

Excel Formulas › Sum

All versionsSUMIFWildcards

To total rows whose label contains a word — every product with “Pro” in the name, all “West”-anything regions — use SUMIF with wildcards. The * stands for any characters.


Quick formula: to total column B where the label in A contains “Pro”:
=SUMIF(A2:A8, "*Pro*", B2:B8)
The asterisks mean “any text before and after,” so it matches anywhere the word appears in the cell.

Functions used (tap for the full reference guide):

The example

Total sales for any product whose name contains “Pro”.

AB
1ProductSales
2Widget Pro$120
3Gadget$90
4Pro Mouse$60
5Cable$40
6Total “Pro” sales:$180

The formula

Total of the “Pro” products:

=SUMIF(A2:A5, "*Pro*", B2:B5) // Widget Pro + Pro Mouse = 180

How it works

Wildcards make SUMIF match partial text:

  1. The criteria "*Pro*" matches any label that has “Pro” somewhere inside — start, middle, or end.
  2. SUMIF adds the matching rows’ values from B2:B5: 120 + 60 = 180.
  3. "Pro*" would match only labels that start with Pro; "*Pro" only those that end with it.
  4. Use ? to match exactly one character, e.g. "A?" matches A1, AX but not ABC.

Match a literal asterisk or question mark by prefixing it with a tilde: "~*" finds a real * character.

Try it: interactive demo

Live demo

Type a fragment to match (wrapped in * automatically).

Total:

Variations

Contains text AND another condition

SUMIFS with a wildcard plus a second test:

=SUMIFS(B2:B5, A2:A5, "*Pro*", C2:C5, "West")

Starts with / ends with

Anchor the wildcard:

=SUMIF(A2:A5, "Pro*", B2:B5) // starts with =SUMIF(A2:A5, "*Pro", B2:B5) // ends with

Match a fragment from a cell

Concatenate the wildcards around a cell value:

=SUMIF(A2:A5, "*"&E1&"*", B2:B5)

Pitfalls & errors

No wildcards = exact match. =SUMIF(A2:A5, "Pro", B2:B5) totals only cells equal to exactly “Pro”. Add * for “contains.”

SUMIF is case-insensitive. “pro” and “PRO” both match. There is no case-sensitive SUMIF — use SUMPRODUCT with EXACT/FIND if you need that.

Cell-reference criteria need concatenation. You can’t put wildcards on a bare cell; build the string: "*"&E1&"*".

Practice workbook

📊
Download the free Sum if Cell Contains Text practice workbook
The product list with live SUMIF wildcard totals, starts-with/ends-with and SUMIFS variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I sum cells that contain specific text in Excel?
Use SUMIF with wildcards: =SUMIF(A2:A8, "*Pro*", B2:B8) totals rows whose label contains "Pro" anywhere. The asterisks mean any characters before and after.
How do I sum cells that start with or end with text?
Anchor the wildcard: "Pro*" matches labels starting with Pro, and "*Pro" matches labels ending with Pro.
How do I use a cell value as the contains criterion?
Concatenate the wildcards around the cell: =SUMIF(A2:A8, "*"&E1&"*", B2:B8).

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: SUMIFS with multiple criteria · Sum by month

Function references: SUMIF · SUMIFS