In this article we will show how to use the IF function with the not equal operator to create an if not equal formula. Example formulas and images included.
For our example we will compare the values in Column B to the values in Column A. We want to see when the two values are the same and display the result in Column C.
Here we will be selecting Cell C2 to compare the values in A2 and B2.
.
In Google Sheets, you can use the "IF" function to create an "IF NOT EQUAL" formula. The original syntax of the IF Formula is
=IF(condition, value_if_true, value_if_false)
Formula Breakdown:
Condition: Logical operation that Google Sheets will use to determine if true or false. We will be using the Not Equal To logical operator by putting the angle bracket symbols “<>” in between the values we want to compare.
Value_if_true: Cell display when condition is satisfied. We want to display Not Equal when the values are the same.
Value_if_false: Cell display when condition is not satisfied. We want to display Equal when values are not the same.
Following this our Modified IF NOT EQUAL formula becomes
=IF(Value1<>Value2,value_if_not_equal,value_if_equal)
Which we can then apply to our example as
=if(A2<>B2,"Not Equal","Equal")
We will copy the formula to cell C3 up to cell C16 and see that when the values are not equal, Column C displays Not Equal.
Additional Tips:
If you enjoyed this article, you might also like our article on how to check if a cell is empty in Google Sheets or our article on how to set up Google Sheets IF Not error.
If you want to learn how to set up Google Sheets email validation, we also suggest checking out our detailed guide.