To sum values in Excel when a text condition does not contain a specific substring, use the SUMIFS function with a wildcard and negation: =SUMIFS(sum_range, criteria_range, "<>*substring*"). This excludes rows where the criteria range includes the substring anywhere in the text. You must have Microsoft Excel installed (desktop version) and data organized in columns with clear headers. No add-ins or special setup are required.
What You'll Need
- Microsoft Excel (desktop version: Excel for Microsoft 365, Excel 2021, Excel 2019, or Excel 2016)
- A spreadsheet with at least two columns: one containing text to evaluate (e.g., product names, descriptions), and another with numeric values to sum (e.g., sales, quantities)
- The exact substring you want to exclude (e.g., "discount", "retail", "refurbished")
Step-by-Step
- Open your Excel workbook and ensure your data is clean: no merged cells in the criteria or sum ranges, and each column has a consistent data type (text in the criteria column, numbers in the sum column).
- Identify the exact column ranges you'll use. For example, if your text criteria are in column A (rows 2–100) and values to sum are in column B (rows 2–100), note these ranges precisely.
- Decide the substring to exclude. For instance, to exclude all entries where the text contains "bulk", your substring is "bulk".
- Enter the formula in a blank cell where you want the result to appear. Using the example ranges:
=SUMIFS(B2:B100, A2:A100, "<>*bulk*"). Breakdown:B2:B100is the sum range,A2:A100is the criteria range, and"<>*bulk*"means "not containing 'bulk' anywhere". - Press Enter. Excel evaluates each cell in A2:A100: if it does not contain "bulk" (case-insensitive), the corresponding B value is included in the sum.
- Verify the result: manually spot-check a few rows. For example, if A5 contains "Standard Item (bulk order)" and B5 is 50, it should be excluded. If A7 contains "Retail Pack - Small" and B7 is 25, it should be included.
- Adjust the formula if your data starts at a different row or uses different columns. Always anchor ranges with absolute references (e.g.,
$A$2:$A$100) if you plan to copy the formula elsewhere.
Common Mistakes
- Using
SUMIFinstead ofSUMIFSfor multiple criteria (though here only one is needed,SUMIFSis still required for the wildcard negation pattern). - Forgetting the asterisks (
*) in the criteria string. Without them,"<>bulk"would only exclude exact matches, not partial ones—so "bulk order" would still be counted. - Mixing up the order of arguments: in
SUMIFS, the sum range comes first, unlikeSUMIF. - Including header rows in the range (e.g., using A1:A100 instead of A2:A100), which may cause a #VALUE! error if text headers are treated as zeros.
- Using double quotes inside double quotes without escaping (e.g.,
"<>*"bulk"*"), which breaks the formula. Always write the pattern as one quoted string:"<>*bulk*".
Tips
- Test the pattern first: use
SEARCHorFINDto verify what Excel considers a match. For example,=ISNUMBER(SEARCH("bulk", A2))returns TRUE if "bulk" is present—then confirmSUMIFSexcludes exactly those rows. - For case-sensitive exclusion, combine
SUMPRODUCTwithISERROR(SEARCH()):=SUMPRODUCT((ISERROR(SEARCH("bulk", A2:A100)))*B2:B100). This is more complex but useful for strict casing. - Use named ranges (Formulas > Define Name) for criteria and sum ranges to make formulas readable and easier to maintain.
- Keep the substring short and unique. Avoid common words like "the" or "and" unless necessary—they may unintentionally match too many rows.
- When excluding multiple substrings (e.g., "bulk" OR "refurbished"), add more criteria pairs:
=SUMIFS(B2:B100, A2:A100, "<>*bulk*", A2:A100, "<>*refurbished*").
Troubleshooting
If your formula returns 0, an error, or seems inaccurate:
- Check for #VALUE! or #NAME? errors: ensure Excel recognizes
SUMIFS(it’s built-in in Excel 2007+). If using Excel 2003 or earlier,SUMIFSis unavailable—useSUMPRODUCTinstead. - Verify the substring spelling and case sensitivity: Excel ignores case in wildcards, so "BULK" and "bulk" are treated the same.
- Inspect your data for hidden characters: copy a suspect cell, paste it into Notepad, then back into Excel. If values change (e.g., spaces disappear), use
TRIMandCLEANon the criteria column first. - Confirm no blank rows exist in the middle of your data range—
SUMIFSskips them, but inconsistent ranges cause misalignment. - Test with a small dataset: create 5 rows in a new sheet, manually calculate the expected sum, and compare to the formula result.
- If using Excel Online or mobile apps, note that some wildcard features behave differently or lack support; use the desktop app for reliability.
Frequently Asked Questions
Does this work with numbers stored as text?
Yes—Excel treats numbers-as-text consistently in SUMIFS as long as the sum range is numeric. However, ensure the criteria range isn’t misinterpreted: if a cell shows "123" but is text, it won’t match a number in criteria, but since you’re using wildcards for text, this rarely affects the "does not contain" logic.
Can I exclude multiple different substrings at once?
Yes. Add separate criteria pairs for each substring. For example, to exclude both "bulk" and "sample", use: =SUMIFS(B2:B100, A2:A100, "<>*bulk*", A2:A100, "<>*sample*"). Each pair must be added as a new criteria_range, criteria argument.
Why does my formula ignore rows with empty cells in the criteria column?
SUMIFS treats empty cells as not containing your substring (since an empty string doesn’t match "bulk"). If you want to exclude rows where the criteria cell is blank, add an additional criterion: , A2:A100, "<>".
Does the wildcard "*" match special characters?
Yes—the asterisk matches any sequence of characters, including spaces, numbers, and symbols. For example, "*x*y*" matches "a_x!y_z". To search for literal asterisks or question marks, escape them with a tilde: ~* or ~?.
Can I use this with filtered data?
No—SUMIFS sums all rows in the range, ignoring Excel filters. To sum only visible (filtered) rows, use SUBTOTAL with 109 (sum) or combine SUMIFS with SUBTOTAL in array formulas (advanced).
Is there a limit to how long the substring can be?
Excel’s wildcard pattern limit is 255 characters. As long as your substring is shorter, you’re fine. For very long substrings (e.g., partial product codes), consider using LEFT, MID, or RIGHT functions for precision.