Numbers - The Comparison Operators

background image

The Comparison Operators

You can use comparison operators to compare two values in formulas. Comparison
operations always return the values TRUE or FALSE.

130

Chapter 6

Using Formulas in Tables

background image

Chapter 6

Using Formulas in Tables

131

When you want to determine
whether

Use this comparison operator

For example, if A2 contains 20
and B2 contains 2, the formula

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.

Text 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 text
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, which compare two
values and then perform other operations depending on whether the comparison
returns TRUE or FALSE. For more information about this topic, choose Help > iWork
Formulas and Functions Help or Help > iWork Formulas and Functions User Guide.