IfThen, If

IfThen is a conditional function that returns a value when the condition equals True, and another value when the condition equals False.

The function syntax:

  IfThen(Condition, TrueParameter, FalseParameter)
  • Condition is a logical expression that evaluates to true or false. Full conditional logic can be used as well as complex Boolean operators (And, Not, and Or). A condition can also test for #MISSING and #ERROR values. See the following table for a list of valid conditional operators.

  • TrueParameter and FalseParameter are any valid expression that are evaluated based on the outcome of the condition.

The following table describes the conditional operators that are fully supported. Alternate syntax is listed wherever it is supported by a conditional operator.

Table 51. Conditional Operators

Conditional Operator

Syntax

Logic

Equal To

expression = expression

Tests whether the left expression is equal to the right expression.

Note:

The routine that evaluates the condition does not consider any rounding. If rounding is required, use the Round function.

Example:

1= 4

Returns false

Greater Than

expression > expression

Tests whether the left expression is greater than the right expression.

Example:

1 > 4

Returns false

Greater Than or Equal To

expression >= expression

Tests whether the left expression is greater than or equal to the right expression.

Note:

The correct syntax is “>=”. The syntax “=>” is not supported.

Example:

1 >= 4

Returns false

Less Than

expression < expression

Tests whether the left expression is less than the right expression.

Example:

1 < 4

Returns true

Less Than or

Equal To

expression <= expression

Tests whether the left expression is less than or equal to the right expression.

Note:

The correct syntax is “<=”. The syntax “=<” is not supported.

Example:

1 <= 4

Returns true

Not Equal To

expression <> expression

expression != expression

Tests whether the left expression is not equal to the right expression.

Note:

The routine that evaluates the condition does not consider any rounding. If rounding is required, use the Round function.

Example:

1 <> 4

Returns true

1 != 4

Returns true

IsMissing

IsMissing (reference)

IsMiss (reference)

Tests whether the reference contains a #MISSING result.

Note:

If the reference is an expanded row or column, then all resulting cells must be #MISSING in order for the condition to be true.

Example:

IsMissing([1])

Returns true if row 1 has a #MISSING value.

IsError

IsError (reference)

IsErr (reference)

Tests whether the reference contains an #ERROR result.

Note:

If the reference is an expanded row or column, all resulting cells must be #ERROR in order for the condition to be true. Only formula rows and columns can result in #ERROR.

Example:

IsError([2])

Returns true if row 2 has a #ERROR value.

IsNonNumeric

IsNN (reference)

IsNonNumerid (reference)

IfNN (reference)

IfNonNumber (reference)

Tests whether the reference contains a #MISSING or #ERROR results.

Note:

If the reference is an expanded row or column, all resulting cells must be #MISSING and/or #ERROR in order for the condition to be true.

Example:

IsNN([3])

Returns true if row 3 has a #MISSING or #ERROR value.

Parenthesis

(condition)

Used to group a condition. Used mostly for visual clarity.

Example:

(1 > 4)

Returns false

Table 52. Conditional Operators

Complex Conditions

Syntax

Logic

And

(condition AND condition)

(condition & condition)

Complex condition used to compare two conditions. Returns true if all conditions result in true.

Example:

(1 > 4 AND 5 > 2)

Returns false

Not

NOT (condition)

! (condition)

Used to negate the result by reversing the result of the condition.

Example:

Not (1 > 4)

Returns true

Or

(condition OR condition)

(condition | condition)

Complex condition used to compare two conditions. Returns true if any of the conditions result in true.

Example:

(1 > 4 OR 5 > 2)

Returns true