IF
Checks whether a condition is met, and returns one value if true and another value if false.
Syntax: IF (
condition
,
value_if_true
,
value_if_false
)
Condition
is the value that you want to testvalue_if_true
is the value that is returned if condition evaluates to TRUEvalue_if_false
is the value that is returned if condition evaluates to FALSE
Note: All three arguments (parameters) are required.
Example: IF ( 12 > 2 , 33 , 44 )
Output: 33
Example: IF ( DATE ( 2020 , 01 , 01 ) > TODAY () , 1 , IF ( DATE ( 2030 , 01 , 01 ) > TODAY () , 2 , 0 ) )
Output: If today's date is Jan 1, 2024, the above expression will compute to 2
In the above example, the date values can be included in single quotes without using the date function in the yyyy-mm-dd format as follows:
IF ( '2020-01-01' > TODAY () , 1 , IF ( '2030 , 01 , 01' > TODAY () , 2 , 0 ) )
Last updated
Was this helpful?