You can sum values where a cell does not contain specific text by using the SUMIF function with the asterisk wildcard (*). The formula syntax is =SUMIF(range, "<>*text*", sum_range), where range is the cells to check, text is the word you want to exclude, and sum_range is the cells to add up.

What You'll Need

  • A computer with Microsoft Excel installed (Excel 2007 or later).
  • A spreadsheet containing at least two columns of data: one for the items to filter and one for the values to sum. For example, a column of product names and a column of quantities or prices.
  • Basic knowledge of how to type formulas into a cell.

Step-by-Step

  1. Identify your data columns. Look at your spreadsheet and note the letter of the column that contains the items you want to filter (the criteria column) and the letter of the column that contains the numbers you want to sum (the sum range). For instance, if your data is in columns A and B, the product names are in column A and the quantities are in column B.
  2. Click the cell where you want the total to appear. This is the cell where you will type your formula. It is usually in a row below your data, like cell C1, or in a separate summary table.
  3. Type the SUMIF function. Start typing =SUMIF( in the selected cell. Excel will often suggest the function as you type; you can press the Tab key to accept it.
  4. Select the range to check. Click and drag to highlight the cells in the criteria column (e.g., column A) that contain the items you want to examine. Do not include the header row if you have one. Close the parenthesis for this argument, so the formula looks like =SUMIF(A2:A100,.
  5. Enter the criteria with wildcards. To specify that a cell should not contain a specific text, you use the asterisk wildcard (*). The format is "<>*text*". Replace text with the word you want to exclude. For example, to exclude all items containing the word "Red", type "<>*Red*". Add another comma to separate the next argument.
  6. Select the range to sum. Highlight the cells in the column that contain the numbers you want to add up (e.g., column B). This is the sum_range. Close the parenthesis for the entire function. Your formula should now look like =SUMIF(A2:A100,"<>*Red*",B2:B100).
  7. Press Enter. Press the Enter key on your keyboard. Excel will calculate the sum of all numbers in the sum range where the corresponding cell in the criteria range does not contain the text "Red".
  8. Copy the formula if needed. If you have multiple criteria (e.g., exclude both "Red" and "Blue"), it is often easier to create a helper column with an IF statement or use the SUMIFS function with multiple criteria (see the Tips section for details).

Common Mistakes

One of the most frequent errors is forgetting the quotation marks around the criteria. The wildcard string *text* must be enclosed in double quotes, or Excel will return a #NAME? error. Another mistake is not using the asterisk (*) on both sides of the exclusion word. If you type "<>Red", you are telling Excel to sum only cells that are less than the word "Red" (which is a text comparison), not cells that do not contain the word. The asterisks make the check a "does not contain" pattern match.

Tips

For more complex filtering where you need to exclude multiple specific text strings, the SUMIFS function is powerful. It allows you to add multiple criteria ranges and criteria pairs. To exclude both "Red" and "Blue", you would use the formula =SUMIFS(B2:B100, A2:A100, "<>*Red*", A2:A100, "<>*Blue*"). This sums values in column B where column A does not contain "Red" and does not contain "Blue".

Keep in mind that the wildcard * matches any sequence of characters, including an empty sequence. This means the pattern "<>*" will match any cell that is not empty, effectively summing all non-empty cells. This can be a useful shortcut if you want to ignore blank cells entirely.

Troubleshooting

If your formula returns a result of zero, first check the spelling of the text you are excluding. Excel is case-insensitive, so "red" and "Red" are treated the same, but a typo in the word (e.g., "Reed") will not be caught by the exclusion pattern. Ensure that the range references (e.g., A2:A100) cover all the data you intend to check.

If the formula returns a #VALUE! error, verify that the sum_range contains only numeric values. If it contains text or dates formatted as text, the SUMIF function cannot add them. You can convert text numbers to real numbers by selecting the column, copying it, right-clicking and choosing Paste Special..., selecting Values and checking the box for Add, then clicking OK.

Another issue arises if your data contains leading or trailing spaces. For example, a cell might contain " Red" with a space before the word. The exclusion pattern "<>*Red*" will not match this, and the value will be included in the sum. To fix this, use the TRIM() function on your data column or use the SUBSTITUTE() function in a helper column to remove all spaces, then use that column as your criteria range.

Frequently Asked Questions

Can I exclude a specific number using SUMIF?

No, the SUMIF function is designed to work with text criteria. If you want to exclude a number, you can use the SUMIFS function with a mathematical comparison, such as =SUMIFS(B:B, A:A, "<>100"), where 100 is the number you want to exclude. Note that this will exclude any cell containing the text "100" as well, as it is a text comparison.

What does the asterisk wildcard do in this context?

The asterisk (*) is a wildcard that represents any number of characters. In the pattern "<>*text*", it tells Excel to look for the word "text" anywhere within the cell value. If you omit the asterisks, Excel will only match a cell that is exactly the word "text" and nothing else.

How do I exclude blank cells using SUMIF?

You can use the wildcard pattern "<>" as your criteria. This translates to "does not equal nothing". The formula would be =SUMIF(A2:A100,"<>",B2:B100), which sums all values in column B where the corresponding cell in column A is not empty.

Is there a way to sum cells that do not contain text at all?

Yes, you can check if a cell contains text using the ISTEXT() function. A formula to sum numbers where a cell does not contain text is =SUMIFS(B:B, A:A, "<>", A:A, ISNUMBER)?? Not directly. The standard way is to use =SUMIFS(B:B, A:A, "<>*") to sum all non-empty cells, or to use a helper column with =IF(ISTEXT(A2),0,B2) and sum that column.

Why is my result different from what I expect?

The most likely cause is hidden characters or formatting issues. Ensure that the numbers you are summing are actually in number format. If they are formatted as text, SUMIF will ignore them. Also, check for extra spaces in your data using the TRIM function, as spaces can affect pattern matching.