beautypg.com

The comparison operators – Apple iWork '09 User Manual

Page 29

background image

Chapter 1

Using Formulas in Tables

29

The Comparison Operators

You can use comparison operators to compare two values in formulas. Comparison
operations always return the values TRUE or FALSE. Comparison operators can also
used to build the conditions used by some functions. See “condition” in the table
“Syntax Elements and Terms Used In Function Definitions” on page 34

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.

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, 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.”