Write a basic IF

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

If the score in B2 is at least 50, the cell reads “Pass”; anything lower reads “Fail.” You can return numbers, text, or other formulas in either slot.

Test several conditions with AND or OR

=IF(AND(B2>=50, C2="Yes"), "Approved", "Review")

AND requires every condition to be true; OR needs just one. Combine them inside the IF to build richer rules.

Handle many cases with IFS

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

IFS reads more cleanly than deeply nested IFs. The final TRUE acts as a catch-all for anything left over.

Common mistakes / tips

  • Quote your text. Text results need double quotes, like "Yes"; numbers do not.
  • Order matters in IFS. Excel uses the first condition that is true, so list the strictest test first.
  • Watch comparison signs. Use >= for “at least” and > for “more than.”

Frequently asked questions

How do I nest IF statements?

Put another IF in the false slot: =IF(A1>90, "A", IF(A1>80, "B", "C")). For more than two or three levels, IFS is much easier to read.

Why does my IF show the wrong result?

Usually the condition is comparing text to a number, or there is a stray space. Check that A1 really holds a number and not text that looks like one.

Conditional logic is even clearer in real code. Take the next step with our free Pandas course.