Use Contains or Does Not Contain in an Excel SUMIFS Formula
Question details
Use SUMIFS to sum values based on whether cells contain or do not contain specified text.

- 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.
Identify the range containing the text and the corresponding range of numbers to sum. Make sure the two ranges have the same dimensions.
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.
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.
Select an empty cell and enter =SUMIFS(B2:B100,A2:A100,"<>*white*") to exclude rows whose column A text contains white.
In the formula bar, replace the example ranges and white with your own ranges and search text, then press Enter.
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. Open the spreadsheet: Open WPS Spreadsheets and select Open to load your workbook.
- 2. Select a result cell: Click an empty cell where you want the sum to appear.
- 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. Apply your ranges: Replace the example ranges and text with your own, then press Enter.

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.




