Relational operators

The relational operators compare dates, strings and numbers, comparing the left-hand operand with the right-hand operand.

The result is a Boolean value, TRUE or FALSE as appropriate.

Note that both operands must be of the same type (e.g. both numbers) to gain a useful result.

< Less than

<= Less than or equal to

<> Not equal to

= Equal to

> Greater than

>= Greater than or equal to

For example, the formula:

B8>10

will compare the contents of cell B8 with the number 10. If B8 contains a number greater than 10, the result will be the Boolean value TRUE. If B8 contains a number which is 10 or less, the result will be FALSE. If B8 contains text or a date, the result will also be FALSE.

Comparing strings using wildcards

When comparing text strings there are three wildcards you can use in the right-hand side of the comparison.

^? Matches any single character not including space

^# Matches any number of characters including spaces

^^ Matches the character ^

Example:

"Venice"="^#nice"

will return the Boolean value TRUE.

Example:

Relational operators are useful for establishing the condition for the IF function, and in database functions.

The following function displays the first text message in the cell if the condition is true, and the second if it is not true:

IF(A1<B1, "A1 less than B1", "A1 not less than B1")