comparison operator

A comparison operator compares two values in formulas. Comparisons always return either the boolean value TRUE or the boolean value FALSE. Comparison operators can also be used to build the comparison conditions used by some functions.

To determine whether

Use this comparison operator

Examples, when A2 contains 20 and B2 contains 2

Two values are equal

=

A2 = B2 returns FALSE

Two values aren’t equal

<>

A2 <> B2 returns TRUE

The first value is greater than the second value

>

A2 > B2 returns TRUE

The first value is less than the second value

<

A2 < B2 returns FALSE

The first value is greater than or equal to the second value

>=

A2 >= B2 returns TRUE

The first value is less than or equal to the second value

<=

A2 <= B2 returns FALSE

Strings are larger than numbers. For example, “hello” > 5 returns TRUE.

TRUE and FALSE can be compared with each other, but not with numbers or strings. TRUE > FALSE and FALSE < TRUE because TRUE is interpreted as 1 and FALSE is interpreted as 0. TRUE = 1 returns FALSE, and TRUE = “SomeText” returns FALSE.

Comparison operations are used primarily in functions, such as IF, that compare two values and then perform other operations depending on whether the comparison returns TRUE or FALSE.