Back to functions
Logical2026-03-145 related articles

IF Function in Excel

Test a condition and return one result for TRUE and another for FALSE.

Syntax

IF(logical_test, value_if_true, [value_if_false])

Arguments

logical_test

Required

The comparison or expression that Excel evaluates as TRUE or FALSE.

value_if_true

Required

The value or formula returned when the test is TRUE.

value_if_false

Optional

The value or formula returned when the test is FALSE.

What it returns

Returns one of two results based on whether the logical test passes.

What IF does

IF is Excel's core decision-making function. It evaluates a condition and then branches to one result when the condition is true and another when it is false.

That makes it useful for pass/fail labels, clean output, error prevention, and business rules that depend on thresholds.

Practical examples

Return a label based on a threshold

=IF(B2>=70,"Pass","Review")

This is the simplest IF pattern: compare a value, then return one of two labels.

Avoid division by zero

=IF(C2=0,"",B2/C2)

Here IF prevents an avoidable error and keeps the report readable when there is no valid denominator.

Common mistakes and notes

Forgetting text quotes

Text results such as "Pass" or "Late" need quotation marks. Numeric results do not.

Over-nesting

Long chains of nested IF formulas become hard to read and hard to debug. When a worksheet depends on many branches, consider lookup tables or functions such as SUMIFS, VLOOKUP, or INDEX plus MATCH.

Leaving the false branch undefined

If you omit value_if_false, Excel returns FALSE. Sometimes that is useful, but on reports it often looks like a mistake.

Related functions

Related articles

Deep dives, troubleshooting guides, and practical examples that use IF.

Official documentation