The inequality (!=
) operator returns true if its operands are not equal. It accepts operands of all data types – strings, numbers, Booleans, and dates.
string != string
number != number
boolean != boolean
date != date
list != list
unequal(string, string)
unequal(number, number)
unequal(boolean, boolean)
unequal(date, date)
unequal(list, list)
string.unequal(string)
number.unequal(number)
boolean.unequal(boolean)
date.unequal(date)
list.unequal(list)
Code language: JavaScript (javascript)
Good to know: Notion now allows for comparisons between different data types, and the inequality operator (!=
) will act as a strict inequality operator. For example, "1" != 1
will return true
You can also use the function version, unequal()
.
Example Formulas
1 != 2 /* Output: true */
1 != 1 /* Output: false */
unequal("Cat","Dog") /* Output: true */
"Cat".unequal("Dog") /* Output: true */
"1" != 2 /* Output: false */
2^3 != 10 /* Output: true */
Code language: JavaScript (javascript)
Good to know: The inequality (!=
) operator cannot be chained in a Notion formula. A formula like 1 != 2 != 3
won’t work. Use the and operator to get around this – e.g. 1 != 2 and 2 != 3
.
Example Database
The example database below contains a Cat Status property that will inform you on whether or not your lawyer is a cat.
View and Duplicate Database
“Cat Status” Property Formula
(prop("Type") != "Cat") ? "Your lawyer is not a cat." : "Your lawyer is a cat."
Code language: JavaScript (javascript)
If you understand this well, you may want to check out the more complex example on the equality (==
) operator’s page.