Returns a value based on a logical test.
Sample Usage
IF(C4>B4,C4-B4,0)
IF(C5="Yes",1,2)
Syntax
IF(logical_expression, [then_value], [otherwise_value])
- logical_expression - The expression that is to be tested. The expression must be either TRUE or FALSE.
- then_value - [OPTIONAL] The value to be returned if the result of the logical test is TRUE.
- otherwise_value - [OPTIONAL] The value to be returned if the result of the logical test is FALSE.
Examples
IF(C4>B4,C4-B4,0) checks for the logical expression C4>B4. If the expression is true, it returns C4-B4. Else, it returns 0.
IF(C5="Yes",1,2) checks for the logical expression C5="Yes". If the expression is true, it returns 1. Else, it returns 2.
Notes
- Ensure that then_value and otherwise_value are provided in the correct order.