Function Problems

Use Contains or Does Not Contain in an Excel SUMIFS Formula

Natalie TaylorNatalie Taylor Nov 14, 2026 870 views

Question details

Use SUMIFS to sum values based on whether cells contain or do not contain specified text.

Use Contains or Does Not Contain in an Excel SUMIFS Formula
Product
Microsoft Excel and WPS Spreadsheets
Device & OS
not provided
Scenario
A user wants to filter text that may appear anywhere within a cell while summing values in another range.
Observed behavior
The formula should match or exclude cells containing the specified text regardless of its position.
Before you start

Identify the range containing the text and the corresponding range of numbers to sum. Make sure the two ranges have the same dimensions.

Solution 1Recommended

Use wildcard criteria to match or exclude partial text

Use an asterisk on each side of the search text to match it anywhere in a cell, and add <> to exclude it.

These examples assume that A2:A100 contains text and B2:B100 contains the values to sum.

1
Sum cells containing the text

Select an empty cell and enter =SUMIFS(B2:B100,A2:A100,"*white*") to sum values in column B when the corresponding cell in column A contains white.

2
Sum cells that do not contain the text

Select an empty cell and enter =SUMIFS(B2:B100,A2:A100,"<>*white*") to exclude rows whose column A text contains white.

3
Adjust the ranges and text

In the formula bar, replace the example ranges and white with your own ranges and search text, then press Enter.

Wildcard behavior: The asterisk matches any number of characters, so the text can appear at the beginning, middle, or end of a cell.
Work with SUMIFS in WPS

Sum values by partial text in WPS Spreadsheets

Use SUMIFS and wildcard criteria in WPS Spreadsheets to include or exclude rows based on text within a cell.

  1. 1. Open the spreadsheet: Open WPS Spreadsheets and select Open to load your workbook.
  2. 2. Select a result cell: Click an empty cell where you want the sum to appear.
  3. 3. Enter the formula: Type =SUMIFS(B2:B100,A2:A100,"*white*") for a contains condition, or =SUMIFS(B2:B100,A2:A100,"<>*white*") to exclude matching text.
  4. 4. Apply your ranges: Replace the example ranges and text with your own, then press Enter.
Match or exclude partial text with SUMIFS wildcardsOpen and edit Microsoft Excel XLS and XLSX filesUse a familiar spreadsheet interfaceWork with spreadsheets for free
microsoft office alternative - wps office

Frequently Asked Questions

How do I use text from another cell as the search term?

If D2 contains the search term, enter =SUMIFS(B2:B100,A2:A100,"*"&D2&"*") in a result cell. For a does-not-contain condition, use "<>*"&D2&"*" as the criterion.

Is the SUMIFS text match case-sensitive?

No. SUMIFS normally treats uppercase and lowercase letters as equivalent, so "*white*" also matches text containing "White".

How can I match a literal asterisk instead of using it as a wildcard?

Put a tilde before the asterisk in the criterion. For example, use "*~**" to match cells containing a literal asterisk.

Can I add another condition to the formula?

Yes. Add another criteria range and criterion after the first pair. For example, =SUMIFS(B2:B100,A2:A100,"*white*",C2:C100,"North") also requires the corresponding cell in column C to equal North.