1. Calculation functions
  2. All Functions
  3. Logical Functions
  4. IF THEN ELSE

Tests an argument for truth and returns one of two values based on the result.

Syntax

IF x THEN y ELSE z

where:

  • x: Boolean argument to test
  • y: Response if TRUE
  • z: Response if FALSE

You can use spreadsheet syntax:

IF (a > b,y,z)

Anaplan converts it to:

IF a > b THEN y ELSE z

Format

Input Format Output Format

x: Boolean

y: Number, Boolean, date, time period, list item, text

z: Number, Boolean, date, time period, list item, text

Arguments

The function uses the following arguments:

  • x: Expression that equates to a Boolean result
  • y: Text-formatted line item, text constant, or general expression, Number - Numeric line item, property, or expression
  • z: Text-formatted line item, text constant, or general expression, Number - Numeric line item, property, or expression

Constraints

The function has no constraints.

Excel equivalent

Back to Top

Example

Description

Formula Syntax Example

where a & b are numeric

c is list type

d is text

e is boolean

f is date format

Result Data Type
IF THEN ELSE IF a > 1000 THEN 1 ELSE 2 Number
IF THEN ELSE IF IF a < 2000 THEN 1 ELSE IF a < 4000 THEN 2 ELSE 3 Number
IF THEN ELSE IF IF a >= 5000 THEN Size.Large ELSE IF a >= 3000 THEN Size.Medium ELSE Size.Small List

OR

with result as a check box

a > 1000 OR b > 1000 Boolean
IF OR IF a > 1000 OR b > 1000 THEN 1 ELSE 0 Number
IF AND IF a > 1000 AND c = Products.Bananas THEN 1 ELSE 0 Number

NOT

with result as a check box

NOT (a > 1500) Boolean
IF NOT IF NOT (a > 1500) THEN 1 ELSE 0 Number

ISBLANK

with result as a check box

ISBLANK(c) Boolean
ISBLANK ISBLANK(d) Boolean
IF ISBLANK IF ISBLANK(c) THEN 1 ELSE 0 Number
IF ISNOTBLANK IF ISNOTBLANK(c) THEN 1 ELSE 0 Number
IF ITEM( ) THEN IF ITEM(Organization) = Organization.London THEN 1 ELSE 2 Number

IF ITEM() THEN

with result as list item

IF ITEM(Organization) = Organization.London THEN Landmarks.Big Ben ELSE IF
ITEM(Organization) = Organization.Birmingham THEN Landmarks.Bullring ELSE IF
ITEM(Organization) = Organization.Paris THEN Landmarks.Eiffel Tower ELSE IF
ITEM(Organization) = Organization.Lyon THEN Landmarks.'Cathédrale Saint-Jean' ELSE IF
ITEM(Organization) = Organization.Munich THEN Landmarks.Hofbrauhaus ELSE IF
ITEM(Organization) = Organization.Berlin THEN Landmarks.Brandenberg Gate ELSE IF
ITEM(Organization) = Organization.Los Angeles THEN Landmarks.Hollywood ELSE Landmarks.Statue of Liberty
List

IF THEN

with list format result as BLANK

IF a < 3000 THEN Size.Small ELSE BLANK List

IF THEN

with date result BLANK

IF YEAR(f) = 2010 THEN f ELSE BLANK Date

IF THEN

with Boolean result TRUE/FALSE

IF e = TRUE AND b > 0 THEN TRUE ELSE FALSE Boolean

IF THEN

with text result BLANK

IF a < 3000 THEN "This is small" ELSE BLANK Text

IF THEN

with result as Text

IF a > 0 THEN "positive" ELSE IF a < 0 THEN "negative" ELSE "zero" Text

Back to Top

Similar functions