Comparison and Logical operators can be used in the IF function. They are used to compare two values.
Return Values
True or False
Operator | Description | Can be used with |
&& | And |
|
|| | Or |
|
== | Equal to | Number, Text, Date |
!= | Not Equal | Number, Text, Date |
> | Greater Than | Number, Date |
< | Less Than | Number, Date |
>= | Greater than or Equal to | Number, Date |
<= | Less than or Equal to | Number, Date |
Note: Equals requires ‘==’, as ‘=’ will result in an error.
You can only compare two types of data that are the same. The underlying JavaScript code will allow you to compare a string against a number.
Example
Simple arithmetic operations to show the layout and results:
2 == 3 would return FALSE
2 != 3 would return TRUE
Assigning a “Not Popular” or “Popular” value on items that have more than 5 likes
IF(likecount>5, “Popular”, “Not Popular”)