Excel SUMIF Not Equal To Text: Formula and Guide
In this article
To sum values in Excel while excluding a specific piece of text, use the formula =SUMIF(range, "<>text", sum_range). The key is the <> operator, which is the Excel symbol for "not equal to." By placing this operator inside quotation marks before your excluded text, you tell Excel to include every cell in the range except for the one that matches your specified word or phrase.
What You'll Need
- A computer with Microsoft Excel installed (any version from 2007 onwards).
- A dataset containing a column of categories or labels (text) and a corresponding column of numerical values to be summed.
- Basic familiarity with selecting cell ranges in a spreadsheet.
Step-by-Step
- Organize Your Data: Ensure your data is arranged in columns. For example, place your categories (like "Department" or "Status") in Column A and the amounts you want to total (like "Expenses" or "Sales") in Column B.
- Select Your Target Cell: Click on the empty cell where you want the final total to appear.
- Start the Formula: Type
=SUMIF(to begin the function. The SUMIF function requires three pieces of information: the range to check, the criteria for exclusion, and the range to actually add up. - Define the Criteria Range: Highlight the cells that contain the text you want to filter. For example, if your categories are in cells A2 through A10, your formula should now look like
=SUMIF(A2:A10,. - Enter the "Not Equal To" Criteria: This is the most critical part. To exclude a specific word, you must use the
<>operator inside double quotation marks.- If you want to exclude the word Pending, type
"<>Pending". - Your formula should now look like:
=SUMIF(A2:A10, "<>Pending",.
- If you want to exclude the word Pending, type
- Define the Sum Range: Highlight the cells containing the numbers you want to add. If your numbers are in cells B2 through B10, type
B2:B10). - Execute the Formula: Press Enter. Excel will now scan Column A, ignore any row that says "Pending," and sum the corresponding values in Column B.
- (Optional) Link to a Cell Reference: If you don't want to hard-code the text into the formula, you can put the word you want to exclude in a different cell (e.g., cell D1). To do this, use the ampersand symbol to join the operator and the cell:
=SUMIF(A2:A10, "<>"&D1, B2:B10). This allows you to change the excluded word in cell D1 without editing the formula itself.
Common Mistakes
One of the most frequent errors is forgetting the double quotation marks around the criteria. In Excel, any logical operator used within a SUMIF or COUNTIF function (like >, <, or <>) must be enclosed in quotes. If you type =SUMIF(A2:A10, <>Pending, B2:B10), Excel will return a formula error because it doesn't recognize the operator as a text string.
Another common mistake is confusing the range and the sum_range. The first range in the formula is always the range being evaluated against the criteria. The second range is the one being added. If you swap these, Excel will try to check if your numbers are "not equal to text," which will likely result in a total of zero or an incorrect sum because the logic is reversed.
Users also often struggle with trailing spaces. If your data cell contains "Pending " (with a space at the end) but your formula looks for "<>Pending" (without a space), Excel may treat them as different strings. While the "not equal to" operator is generally forgiving, inconsistency in data entry can lead to unexpected results where cells you thought were excluded are actually included in the sum.
Tips
To make your spreadsheets more dynamic, use the cell reference method mentioned in Step 8. This is particularly useful for dashboards where you might want to toggle which category is being excluded from a total without digging into the formula bar.
If you need to exclude multiple different text values, SUMIF cannot do this alone because it only supports one criterion. In this case, switch to the SUMIFS function (with an 'S'). SUMIFS allows for multiple criteria. The syntax changes slightly: the sum_range comes first. For example, to exclude both "Pending" and "Cancelled," you would use: =SUMIFS(B2:B10, A2:A10, "<>Pending", A2:A10, "<>Cancelled").
For those dealing with very large datasets, consider converting your data range into an official Excel Table (Ctrl + T). When you use Table References (like Table1[Status]) instead of cell addresses (like A2:A10), your SUMIF formula will automatically update as you add new rows to the bottom of the list, ensuring your "not equal to" total is always current.
Troubleshooting
If your formula is returning 0 when you know there are values to sum, first check that your numbers are actually stored as numbers. Sometimes, data imported from other software is stored as text. You can tell if there is a small green triangle in the corner of the cell. Select the cells, click the warning icon, and choose "Convert to Number."
If the formula is summing everything (including the text you wanted to exclude), double-check the spelling of the text within your quotation marks. The text must match the cell content exactly. If the cell says "Completed" and your formula says "<>Complete", Excel will include the "Completed" rows because "Completed" is indeed not equal to "Complete".
If you receive a #VALUE! error, ensure that your range and your sum_range are the same size. If your criteria range is A2:A10 (9 cells) but your sum_range is B2:B20 (19 cells), Excel will struggle to map the criteria to the values and may throw an error or provide an inaccurate result.
Frequently Asked Questions
Can I use this to exclude blank cells?
Yes. To sum values where the corresponding text cell is not blank, use "<>" as your criteria. This tells Excel to sum everything that is not empty.
Does the formula care about uppercase or lowercase letters?
No, SUMIF is not case-sensitive. Using "<>Pending" will exclude "pending", "PENDING", and "Pending" equally.
Can I use wildcards with the not equal to operator?
Yes, you can use the asterisk (*) as a wildcard. For example, "<>*West*" will exclude any cell that contains the word "West" anywhere in the text, such as "NorthWest" or "West Coast".
What is the difference between SUMIF and SUMIFS for excluding text?
SUMIF is used for a single exclusion criterion. SUMIFS is used when you have two or more conditions (e.g., exclude "Pending" AND exclude "Cancelled"). Remember that in SUMIFS, the range to be summed is the first argument, not the last.
Can I exclude text based on a partial match?
Yes, by using the wildcard mentioned above. If you want to exclude anything starting with "Test", use "<>Test*". This ensures any cell beginning with those four letters is omitted from the total.