IF Function

Description

Return the specified value based on whether the criteria is true or false.

It takes a boolean value as the first argument and returns the second argument if true or the third argument if false.

If you provide a value other than a boolean for the first argument, an error will occur. A boolean value can be used in a criteria expression, returning true if the criteria are met and false otherwise.

The third argument can be omitted. If you omit it and the first argument is false, the result will be an empty value.

Usage Examples

The following example returns the string “Pass” if the value in the number field is greater than or equal to 80 or the string “Fail” if it is less than 80.

= if(Number >= 80, "Pass", "Fail")

Example of a nested if function: Returns “A” if the number is greater than or equal to 80, “B” if it is less than 80 but greater than or equal to 60, and “C” if it is less than 60.

= if(Number >= 80, "A", if(Number >= 60, "B", "C"))

Here is an example to omit the third argument: If the progress value is 100, it returns “Complete”; otherwise, it returns an empty value.

= if(progress = 100, "Complete")

関連記事