Excel Guide

IF, AND & OR Formulas in Excel, From Basic to Nested

An IF and formula in Excel returns one value if a condition is true and another if it is false: =IF(condition, value_if_true, value_if_false). For example, =IF(A2>=60, "Pass", "Fail") marks a score as Pass only when it is 60 or more. This guide shows that pattern, then how to combine conditions with AND and OR, nest IFs for multiple outcomes, and when to use IFS instead — with 10 practice problems for each pattern. Practise it: Basic IF — 10 Excel practice problems.

The basic IF pattern

Every IF formula has the same three parts: a condition, what to return if it's true, and what to return if it's false.

=IF(condition, value_if_true, value_if_false) =IF(A2>=60, "Pass", "Fail")

That single pattern covers most of what you'll need: pass/fail thresholds, flagging over-budget rows, labeling categories.

IF with AND / OR: checking more than one condition

When a decision depends on more than one thing, wrap your conditions in AND (all must be true) or OR (at least one must be true), and use that as the IF's condition:

=IF(AND(A2>=60, B2="Submitted"), "Pass", "Fail") =IF(OR(A2="Urgent", A2="High"), "Escalate", "Normal")

Three patterns cover most real cases:

AND and OR accept as many conditions as you need, separated by commas, and text comparisons ignore capital letters ("yes" matches "Yes").

Common mistake: typing the word between the conditions, like =IF(A2>=50 AND B2>=50, ...). Excel doesn't read that; AND has to be a function wrapped around the conditions: AND(A2>=50, B2>=50). Likewise =IF(2<=A2<=8, ...) doesn't test "between"; split it into two conditions inside AND.

Nested IF: multiple outcomes

For more than two possible outcomes, you can nest one IF inside another:

=IF(A2>=90, "A", IF(A2>=80, "B", IF(A2>=70, "C", "F")))

This works, but readability drops fast past two or three levels of nesting. That's usually the sign to reach for IFS instead, which lists condition/result pairs without the nested parentheses:

=IFS(A2>=90, "A", A2>=80, "B", A2>=70, "C", TRUE, "F")

The final TRUE, "F" pair acts as a catch-all default, similar to the innermost "else" in a nested IF.

Common mistake: forgetting the order matters in a chain of thresholds. IF(A2>=70, "C", IF(A2>=90, "A", ...)) will never return "A", because anything ≥90 already satisfies ≥70 and returns early. Always check from the highest threshold down (or the lowest up), not in random order.

Try it yourself

Practice IF, AND, OR, and IFS with real interactive exercises and instant feedback.

Start practicing conditional formulas →