Conditional Expressions
This article explains various conditional expressions that can be used in formula fields.
This cheat sheet provides a quick reference guide for various conditional expressions commonly used in data analysis and programming. Each expression is accompanied by its syntax, a sample usage, and a brief description.
IF
The IF function in programming and spreadsheet formulas provides a way to perform conditional operations. It evaluates a condition and returns a value if the condition is TRUE
, or another value if the condition is FALSE
.
Syntax
Sample
SWITCH
The SWITCH function is a versatile tool for handling multiple cases. It evaluates the given expression (expr) against a series of patterns and returns the corresponding value of the first matching pattern. If none match, it returns the default value.
Syntax
Sample
AND
The AND function is a logical operator that returns TRUE only if all its conditions are true.
Syntax
Comparison operators : ==
, !=
, >
, <
, >=
, <=
Sample
OR
The OR function is another logical operator, returning TRUE if at least one of its conditions is true.
Syntax
Comparison operators : ==
, !=
, >
, <
, >=
, <=
Sample
Examples: