Checks a condition given as the first argument of the function and returns one value if the condition is TRUE and returns another value if the condition is FALSE.
IF (<logical_test>, <value_if_true>, [<value_if_false>])
|Sr.No.||Parameter & Description|
Any value or expression that can be evaluated to TRUE or FALSE.
The value that is returned if the logical test is TRUE.
The value that is returned if the logical test is FALSE.
If omitted, FALSE is returned.
Any type of value that can be returned by an expression.
If value_if_false is omitted, IF treats it as an empty string value ("").
If the value referenced in the logical_test is a column, IF returns the value that corresponds to the current row. Thus, the IF function returns a column of all the values resulting from the logical test corresponding to each of the rows.
If you have 3 values to return, then you can nest the IF functions.
Returns a calculated column of 1’s and 0’s. These values can be summed up.
If you name the column as USA Medals, then you can write the following −
then you can write the following -