How to use Does Not Equal Operator in Excel (Formula)

Last Updated: December 26, 2023
puneet-gogia-excel-champs

- Written by Puneet

In Excel, if you want to check if a cell value is not equal to another value, you can use the not equal operator “<>”. It returns FALSE if the value matches and TRUE if it doesn’t match. You can use it as a formula, or you can also use it with other functions like IF, OR, and AND.

In the following example, you have two values in cells A1 and A2 and you need to check if value 1 is not equal to value 2.

two-values-in-cells

Using DOES NOT EQUALS Operator

  1. First, in cell B1, enter the equal operator.
  2. After that, refer to cell A1 where you have the first value.
  3. Next, enter the “<>” not equal operator.
  4. Now, refer to the second value that we have in cell A2.
  5. In the end, hit enter to get the value.
use-not-equals-operator

The moment you hit enter, it returns TRUE in the result. This is because both values are not equal. Now if you enter “Excel” in cell B1, the result that we have in cell A1 changes to FALSE. The reason because we have the same values in both cells.

change-value-in-cell

Using DOES NOT EQUAL with OR – AND

As I said, you can use the not equals operator with other functions as well. Let’s try to use it with AND and OR functions.

With the OR function, you can test two conditions and it will return TRUE if any of the conditions or both conditions are the same. In the following example, we have two conditions to test. Comparing values from cells A1 and A2 and then from B1 and B2.

not-equals-operator-with-or

Now as we are using does not equal operator in both conditions, and in the first condition both values are not equal, so it returns TRUE. But after that in the second condition, both values are the same so the condition is FALSE.

But in the result, we have got TRUE, because as we have discussed, OR returns TRUE if only one condition is TRUE.

Next, use the same with the AND function. AND returns TRUE if all the specified conditions are the same, and FALSE even if one condition is FALSE from all.

not-equals-operator-with-end

In the above example, again we have the same values but when you use AND function it returns FALSE in the result as the second condition (B1<>B2) is not true, both of the values are the same.

Use DOES NOT EQUAL Operator with IF Function

You can also use the does not equal operator within the IF function.

not-equals-operator-with-if
  1. Enter the IF function in a cell where you want to have the result.
  2. After that, refer to cell A1 and then use the not equal operator and refer to cell A2.
  3. Next, use a value to get if the condition is TRUE.
  4. In the end, specify the value if the condition is FALSE.

The best thing about using the IF with the “does not equal” condition is that you can return a specific value that you get if the condition is TRUE or FALSE.

Get the Excel File