Switch Formula

Avatar

By Anjali Daga

updated 2 months ago

Decision control Statements are used to decide the order of execution/flow of control in a program by making a decision based on a condition. Such as IF, ELSEIF statements.
Switch statement is an alternative to IF statement. 

NESTED IF Formula 

You can also add IF conditions to the Nested Formulas. 

IF({IsCompleted ?} = "checked", "MET",IF(ISBEFORE({Due Date}, NOW()), "BEHIND","GOING ON"))

The above formula is used to determine the status of the project. The comparison is with the "task deadline" to "today's" date, and if the checkbox against it was checked off (that it was completed).

SWITCH FORMULA

Switch statement is one of the decision control statements, which is primarily used in a scenario where the user has to make a decision between multiple alternatives.

Switch matches an expression against a series of pattern values, returning the result value corresponding to the first match. Pattern values must be unique. If no pattern matched returns the default value if specific, else Null.

Formula: SWITCH(Expression, [pattern, result],[,default])
Example: SWITCH({Name},4, ‘Planning’, 3, ‘Execution’, 2, ‘Review’, 1, ‘Launch’, ‘Out of range’)

Result: 

Did this answer your question?