ZonoTools

Excel IF Function (Branch on TRUE/FALSE) – Examples & Practice

Practice the Excel IF function online with an interactive grid, instant feedback, and clear formula help.

Instruction

If A2 is at least 85 return "Pass"; otherwise return "Retry".

Formula Syntax

=IF(logical_test, value_if_true, value_if_false)

  • logical_test: Any expression that evaluates to TRUE or FALSE.
  • value_if_true: Result when the test is TRUE.
  • value_if_false: Result when the test is FALSE.

What it does

IF chooses between two outcomes based on a logical test. It is the building block of conditional logic in spreadsheets. Combine IF with AND/OR for multi-condition rules.

Excel IF Function Examples

Simple pass/fail

=IF(A2>=85, "Pass", "Retry")

Returns text based on a numeric threshold.

Numeric bonus

=IF(B2>100, B2*1.1, B2)

Applies a raise only when a target is exceeded.

IF with AND

=IF(AND(A2>0, B2>0), A2*B2, 0)

Multiplies only when both inputs are positive.

logical-checks.xlsx

ABC
1ScoreAttendance %Approved
29296Yes
37888No
48591Yes
56684No
69093Yes
7Output

Input Formula

Need Help?

Tips

  • Keep tests simple; push complexity into helper columns when needed.
  • Align boundary rules with stakeholders (>= vs >).
  • Consider IFS for many tiers without deep nesting.

IF Function Use Cases

  • Grading, approvals, and threshold KPIs
  • Apply surcharges or discounts conditionally
  • Clean data by replacing sentinel values
  • Gate calculations to avoid divide-by-zero
  • Prototype business rules before moving to IFS

Common mistakes - IF function not working

  • Deep nested IF ladders that nobody can audit
  • Mismatched parentheses across nested IF
  • Returning numbers as text accidentally
  • Using IF when IFS or SWITCH is clearer
  • Forgetting to handle ties at boundaries (>= vs >)

FAQ

Can IF return a formula?

Yes. You can return values produced by other formulas in the value_if_true or value_if_false arguments.

How many IFs can I nest?

Excel allows deep nesting, but readability drops quickly; consider IFS or SWITCH for many branches.

Does IF short-circuit?

Excel evaluates both result arguments in many cases; avoid heavy calculations in both branches if possible.

Can IF work with dates?

Yes. Compare dates with operators like >= and return date values or text labels.

IF vs IFS?

IF handles one test. IFS handles multiple ordered tests in one function.

Comparison

Approach Best for
IF One binary decision
IFS Many ordered tests
SWITCH Matching exact values

Example

=IF(A2>=85, "Pass", "Retry")

Advanced examples

IF + IFERROR

Wrap fragile lookups:

=IFERROR(VLOOKUP(...), "Missing")

See IFERROR for dedicated error handling.

Related functions

IFS replaces long nested IF ladders when tests are ordered and mutually exclusive.

IFERROR handles failures, while AND and OR compose richer logical gates before IF returns a value.