IF
LogicalExcel 2007Return one value if a test is TRUE, another if FALSE.
Syntax
IF(logical_test, value_if_true, [value_if_false])
Arguments
- logical_test
- Any expression that evaluates to TRUE or FALSE, e.g. A2>=40.
- value_if_true
- Returned when the test is TRUE.
- value_if_falseoptional
- Returned when FALSE. Omitted β FALSE.
Examples
=IF(A2>=40, "Pass", "Fail")
β Pass / Fail
=IF(A2="", "", A2*B2)
β Blank stays blank.
Good to know
- Nesting more than 2β3 IFs gets unreadable β use IFS, SWITCH, or a lookup table.
Related functions
More Logical functions
Syntax follows Microsoftβs documentation. Examples are written to be pasted into a cell and checked. Argument separators may be ; in your locale. The AI explainer runs on a free community model β verify anything important.