DXForms
All Guides
IF FunctionNested IFIFSExcel FunctionsLogical Functions

Excel IF Function & Nested IF: A Practical Guide

March 16, 2026

The IF function is the most fundamental logical function in Excel. It returns different results based on whether a condition is true or false — “If this, then A, otherwise B.” It is used in nearly every business scenario: grading, pass/fail decisions, discount calculations, and more.

IF Function Syntax

=IF(condition, value_if_true, value_if_false)
  • condition: An expression that evaluates to TRUE or FALSE
  • value_if_true: The value returned when the condition is met
  • value_if_false: The value returned when the condition is not met

Basic Example

Suppose you have this grade data:

A (Name)B (Score)
Alice85
Bob42
Carol68

Pass/Fail (threshold: 60)

=IF(B2>=60, "Pass", "Fail")
NameScoreResult
Alice85Pass
Bob42Fail
Carol68Pass

Combining with AND / OR

Use AND or OR inside IF when you need to test multiple conditions at once.

AND — All conditions must be true

Pass only if both Math and English are 70 or above:

=IF(AND(B2>=70, C2>=70), "Pass", "Fail")

OR — At least one condition is true

Award “Honors” if either Math or English is 90 or above:

=IF(OR(B2>=90, C2>=90), "Honors", "Standard")

Nested IF — Three or More Outcomes

When you need more than two outcomes, nest one IF inside another.

Letter Grade Classification

ScoreGrade
90 and upA
80 and upB
70 and upC
60 and upD
Below 60F
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", IF(B2>=60, "D", "F"))))

The order of conditions matters — always test the largest value first so each level falls through correctly.

IFS Function — A Cleaner Alternative

Excel 2019 and Microsoft 365 offer the IFS function, which is much easier to read than deeply nested IF statements.

=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", B2>=60, "D", TRUE, "F")
  • The final TRUE acts as a default (“everything else”) clause.
  • Only one set of parentheses is needed, making the formula far more readable.
Nested IFIFS
ReadabilityGets complex fastClean and flat
CompatibilityAll versionsExcel 2019+
Default valueLast false argumentTRUE, value

Real-World Example: Overtime Pay

Calculate pay rate based on hours worked:

Hours WorkedRate
Over 8$30/hr (overtime)
Over 4$22/hr
4 or fewer$15/hr
=IF(B2>8, B2*30, IF(B2>4, B2*22, B2*15))

Common Mistakes

Forgetting quotes around text comparisons

# Wrong — causes an error
=IF(B2=Pass, "O", "X")

# Correct
=IF(B2="Pass", "O", "X")

Not handling blank cells

To check whether a cell is empty, compare it to "":

=IF(B2="", "Not entered", B2)

Mismatched parentheses in nested IF

Each nested IF adds another closing parenthesis. Click on a parenthesis in the formula bar to highlight its matching pair — this helps you spot errors quickly.

Quick Reference

ScenarioFormula Pattern
Simple branch=IF(condition, true, false)
Multiple conditions=IF(AND(cond1, cond2), true, false)
Multi-level branch=IF(cond1, val1, IF(cond2, val2, val3))
Clean multi-level=IFS(cond1, val1, cond2, val2, TRUE, default)

The IF function is powerful on its own, but combining it with VLOOKUP, SUMIFS, or other functions lets you automate even more complex workflows.

More Guides