Does Not Equal Operator in Google Sheets

We can use the does not equal operator in Google Sheets to test a condition. To enter this operator, you need to use the lower than and greater than operator jointly (<>). With Does Not Equal, you can test whether two values are not the same.

lower-and-greater-than-operators

In this tutorial, we will learn to use it and then use it with functions like OR and AND.

Write a Formula with Does Not Equal Operator

  • First, enter an equal sign.
  • After that, refer to the cell with the first value.
  • Next, use the not equals sign by entering <> using the keyboard keys.
  • Now, refer to the cell with the second value.
  • In the end, hit enter to get the result.
formula-with-does-not-equal-operator
=A1<>A2

The above example shows Yes in cell A1 and No in cell A2. When you use the formula (=A1<>A2) it returns TRUE in the result as both values are not the same, Yes <> No.

But if values are the same in both the cells, then you will get FALSE, just like the below example.

result-as-false-if-values-are-same

As I said at the start, does not equal operator is a combination of lower than and greater than the operator. So, it this important to enter them correctly.

Using DOES NOT EQUAL with OR – AND Functions

You can simultaneously use the not-equal operator to test multiple conditions with the AND- OR functions.

does-not-equal-with-and-or

In the above example, we have two conditions to test:

  • A1<>A2, which is TRUE.
  • B1<>B2, which is FALSE.

And in the result, we have TRUE. The OR function returns TRUE even if one condition is true and the first condition is true here. That A1 is not equal to the A2.

=OR(A1<>A2,B1<>B2)

In the same way, you can use AND for more than one condition.

use-and-to-more-than-one-condition

In the above example, we use the same data and here AND returns FALSE. The first condition is true, and the second condition is false. AND only returns true when all the conditions you are testing are true.

=AND(A1<>A2,B1<>B2)

Does not Equal with IF

When testing a condition, it is always good to use the IF. With IF, you can get a meaningful result.

does-not-equal-with-if
=IF(A1<>A2,"Not Equal", "Equal")

With this formula, IF tests the condition of whether cell A1 is not equal to A2. Here the condition is TRUE (A1 is not equal to A2), and IF has returned “Not Equal”.

Get the Sample Sheet