Skip to content

IF

LogicalExcel 2007

Return 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

← All 510 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.