Excel worksheet formulas do not use the everyday ≠ symbol or the programming-style != operator. In normal cells, the not equal operator is <>. Use these fixes to compare, count, filter, highlight, and block values that do not match.
1. Compare two cells with <>
- 1.Select the cell where you want the result.
- 2.Type =A1<>B1, replacing A1 and B1 with your own cells.
- 3.Press Enter.
- 4.Read the result: Excel returns TRUE when the two values are different and FALSE when they match.
2. Enter it from the Formula Bar
Use the formula bar when you want to edit above the worksheet grid. Select the result cell, click the Formula Bar, type =A1<>B1, then select the formula bar check mark or press Enter. The formula calculates the same way because the operator is still <>.
3. Reverse an equality test with NOT
- 1.Select a blank cell.
- 2.Type =NOT(A1=B1).
- 3.Press Enter.
- 4.Use the result the same way you would use =A1<>B1.
- 5.For guided entry, choose Formulas > Insert Function, search for NOT, then enter A1=B1 in the Logical argument.
Use <> for short comparisons and NOT when reversing an equality test reads cleaner.
4. Return words with IF
This fixes comparisons that need labels instead of TRUE and FALSE.
- 1.Select the result cell.
- 2.Type =IF(A1<>B1,"Different","Same").
- 3.Press Enter.
- 4.Change Different and Same to the exact text you want Excel to display.
- 5.For guided setup, choose Formulas > Insert Function, select IF, enter the logical test with <>, then add the two return values.
5. Count or sum values that differ
- 1.Select a result cell.
- 2.To count one not-equal condition, type =COUNTIF(A:A,"<>Apples").
- 3.To count against a value in another cell, type =COUNTIF(B2:B5,"<>"&B4).
- 4.To count rows with more than one condition, type =COUNTIFS(A:A,"<>Apples",B:B,"East").
- 5.To sum values while excluding one criterion, type =SUMIF(criteria_range,"<>value",sum_range).
- 6.To sum with multiple conditions, type =SUMIFS(A2:A9,B2:B9,"<>Bananas",C2:C9,"Tom").
- 7.Press Enter.
Keep <> inside quotation marks when it is part of a COUNTIF, COUNTIFS, SUMIF, or SUMIFS criterion.
6. Filter rows that do not match
This fixes a sheet where matching rows need to disappear while everything else stays visible.
- 1.Click a cell in the range or table.
- 2.Choose Data > Filter.
- 3.Select the filter arrow in the column you want to check.
- 4.For text, open Filter, choose Choose One, select Does Not Equal, enter the value, then select OK.
- 5.For numbers, choose Number Filters, use the not-equal comparison or choose Custom Filter > Does Not Equal, enter the number, then select OK.
7. Highlight cells that differ
- 1.Select the cells you want to format.
- 2.Choose Home > Conditional Formatting > New Rule.
- 3.Select Use a formula to determine which cells to format.
- 4.Enter a formula such as =A1<>$B$1.
- 5.Choose the format you want.
- 6.Select OK.
Lock the comparison cell with dollar signs, such as $B$1, when every selected cell should compare with the same value.
8. Block a forbidden value
Data validation can reject entries that equal a value you do not allow. Select the cells, then choose Data > Data Validation > Settings > Allow > Custom and enter a formula such as =A1<>"Forbidden", using the active cell reference for the selected range. Set Input Message and Error Alert if you want Excel to show instructions or an error message, then select OK.
9. Avoid the wrong not equal signs
This fixes entries that look like not-equal comparisons but do not calculate as worksheet formulas.
- 1.Use <> in normal Excel formulas, not !=.
- 2.Use the visual ≠ symbol only as text in labels or documentation.
- 3.Use != in Python in Excel code. In Office Scripts, which use TypeScript, use != or !==. Neither works in a normal worksheet formula.
- 4.In a PivotTable, open the filter drop-down, clear the unwanted item, and select OK.
- 5.In Power Query, open the loaded query with Query > Edit, select the column filter arrow, choose Text Filters or Number Filters > Does Not Equal, enter the value, select OK, then choose Close & Load.
Frequently Asked Questions
What is the not equal sign in Excel formulas?
The not equal operator in regular Excel worksheet formulas is <>. For example, =A1<>B1 returns TRUE when A1 and B1 are different.
Can I use != for not equal in Excel?
Not in normal worksheet formulas. Excel formulas use <>. The != operator applies to Python in Excel code, while Office Scripts can use JavaScript-style != or !==.
How do I count cells that are not equal to a value in Excel?
Use COUNTIF with the operator inside the criterion, such as =COUNTIF(A:A,"<>Apples"). To compare against another cell, use a formula such as =COUNTIF(B2:B5,"<>"&B4).
Does the ≠ symbol work in Excel formulas?
No. The ≠ symbol is for display text only. Use <> when you want Excel to calculate a not-equal comparison.











