The IF function in Excel checks for a true or false condition. If the condition is true, the function returns a value, if the condition is false, the function returns another value
The function usually has 3 arguments: the condition you want to test, the return value if the condition is true, and the return value if the condition is false.
Syntax: =IF (logical_test, [value_if_true], [value_if_false])
As you see, the IF function has 3 arguments, but only the first one is obligatory, the other two are optional.
- logical_test – A value or logical expression that can be evaluated as TRUE or FALSE.
- value_if_true – [optional] The value to return when logical_test evaluates to TRUE.
- value_if_false – [optional] The value to return when logical_test evaluates to FALSE.
Example: For example, take a look at the IF function in cell B2 below.
Syntax: =IF(B2>80, “Good”,”Bad”)
Result:
Same: