IF()
Returns one value if a condition is true and another if it's false.
IF(logical_test, value_if_true, [value_if_false])IF is the basic branching function: test a condition, return one thing if it's true, another if it's false. Nesting several IFs to handle more than two outcomes gets unreadable fast — IFS is usually clearer.
value_if_false is technically optional; omitting it returns FALSE when the condition doesn't hold, which is rarely what you want.
Arguments
- logical_test
- Any condition or expression that evaluates to TRUE or FALSE.
- value_if_true
- What to return when logical_test is TRUE.
- value_if_falseoptional
- What to return when logical_test is FALSE. Defaults to FALSE if omitted.
Examples
=IF(B2>=60, "Pass", "Fail")→Pass
Returns Pass when B2 is 60 or more.
=IF(C2="", "Missing", C2)→Missing
A common pattern for flagging blank cells.