The Google Sheets Does Not Equal symbol is <> and is a logical operator used for comparing two values. Logical operators are something you are probably already very familiar with (you just might not know it). When discussing logical operators outside of programming we normally refer to less than “<“, greater than “>” and equals “=”. Reminder, all logical operators evaluate to a boolean value of TRUE or FALSE
Ex. Is 5 apples less than “<” 10 apples. We all know this is TRUE as 5 is less than 10.
In programming languages we also have logical operators but there are few more complex ones that take a bit of getting used to. The one we are looking at today is known as “does not equal”.
Logical Concept of Not Equals
Not equals at its core is just the opposite evaluation of equals. Conceptually that means the following,
If two values are evaluated using EQUALS and return TRUE, then the same two values evaluated with NOT EQUALS will return FALSE. The inverse statement works the same way with NOT EQUALS resulting in the OPPOSITE value.
- If Evaluating A “equals” A, returns to TRUE
- Evaluating A “not equals” A, returns FALSE
If two values are evaluated using EQUALS and return FALSE, then the same two values evaluated with NOT EQUALS will return TRUE.
- If Evaluating A “equals” B, returns to FALSE
- Evaluating A “not equals” B, returns TRUE
Again to keep it as simple as possible if equals evaluates TRUE not equals will evaluate FALSE, it is always the opposite. It is for this reason in most other languages not equals is actually a compound symbol of != where “!” means NOT or OPPOSITE and “=” means equals. As you can imagine this compound symbol of != means opposite of equals.
Examples of when to use Not Equals
In my experience the most common use case for “Not Equals” is when you are dealing with filtering lists of things or comparing against a list of items. Not equals also works really well against lists that change over time. Imagine the following scenario,
Let’s say you have a list of students and the districts they are in. Annie and Bob are in district 1, Charlie and Dave are in district 2, and Evan and Fiona are in district 3. You now want to see who is NOT in district 3.
If we didn’t have the “not equals” logical operator we would have to write this as district = 1 OR district = 2 to get the answer. Let’s fast forward into the future and we want to add 97 more districts for 100 districts total? We would have to add OR statements for every new district added: district = 1, OR district = 2, OR ….. district = 100 to get everyone who ISN’T in district 3. Sure seems like a terrible use of time and space right?
Luckily we case use the “not equals” operator instead of writing all those OR’s. By using District “not equals” 3 it doesn’t matter how many other districts there are OR if more districts are added later on your formula still works.
Google Sheets Not Equal
In Google Sheets the “Not Equals” symbol is <> for example, A<>B = TRUE. What you may not realize is there is a second way to write this conceptually using the not() function. For example not(A=B) = TRUE as well. To make it easier to see and understand how to use the Google Sheets Does Not Equal syntax we have provided this template spreadsheet for you. Feel free to copy and edit it as needed.
Learn More About Google Sheets
Google Sheets is a powerful and fee tool for organizing and analyzing data. Check out our other Google Sheets articles to learn how to become a spreadsheet expert – https://nathanielkam.com/tag/google-sheets/