Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

Excel IF Formula with AND and OR: Examples You Can Copy

Excel IF formula with AND and OR examples
Illustration: Excel IF formula with AND and OR

The Excel IF formula with AND and OR lets you test more than one condition in a single cell. Use AND when every condition must be true, and OR when any one condition is enough. This guide shows the exact formulas, with made-up data, plus how to combine AND and OR and how to avoid the common mistakes.

The basic IF formula

IF has three parts: a test, the result if the test is true, and the result if it is false.

=IF(B2>=50, "Pass", "Fail")

If the score in B2 is 50 or more, the cell shows Pass. Otherwise it shows Fail.

Excel IF AND formula: all conditions must be true
Made-up scores and attendance (illustration).

IF with AND: all conditions must be true

Put AND inside the test. Say B2 holds a score and C2 holds the word Yes or No for attendance:

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

The result is Pass only when the score is 50 or more and the attendance is Yes. If either one fails, the result is Fail.

Excel IF OR formula: one condition is enough
Either condition gives the result (illustration).

IF with OR: one condition is enough

Use OR when any single condition should give the result:

=IF(OR(B2>=90, C2="Yes"), "Bonus", "No bonus")

This gives Bonus when the score is 90 or more, or when the attendance is Yes, or both.

Combine AND and OR in one IF

You can place OR inside AND, or the other way round. For example, to pass someone who scored 50 or more and who either attended or has a note:

=IF(AND(B2>=50, OR(C2="Yes", D2="Note")), "Pass", "Fail")

Work from the inside out: Excel first checks the OR, then uses its answer in the AND.

Excel nested IF formula for grades A, B and C
The first true test wins (illustration).

Nested IF as another option

When you need more than two results, nest one IF inside another:

=IF(B2>=90, "A", IF(B2>=75, "B", "C"))

Read it left to right. The first true test wins. Keep nested formulas short, because long ones are hard to check. Our guide to multiple IF statements covers the same idea in Google Sheets.

Excel IF AND OR formula mistakes: quotes, brackets and spaces
Common mistakes (illustration).

Common IF, AND and OR mistakes

  • Text without quotes. Write "Yes" with quotes, or Excel looks for a name.
  • Numbers in quotes. Write B2>=50, not B2>="50".
  • Wrong bracket count. Every opening bracket needs a closing one. Excel colors matching pairs as you type.
  • Extra spaces in the data. "Yes " is not the same as "Yes".
  • Mixing up AND and OR. Say the rule out loud first. "Both" means AND, "either" means OR.

Excel IF with AND and OR: common questions

How many conditions can AND and OR take?

Both accept many conditions, separated by commas. Check the current Excel help page for the exact limit in your version.

Can I use IF with AND and OR in Google Sheets?

Yes, the same formulas work in Google Sheets.

What is the difference between IF and IFS?

IFS tests several conditions in order without nesting. It is available in newer versions of Excel, so check yours.

Related guides on Sheets AI Hub

Use these formulas with conditional formatting, count the results with COUNTIFS, and read about Excel automation tips.

العربية