Excel IF Formula Guide: From Basic to Nested

SheetFix AI

IF is how a spreadsheet makes decisions. It checks whether something is true and returns one result if it is and another if it isn't. Once you understand it, you can automate flags, categories, grades, and alerts. Here's the full picture.

The basic syntax.

=IF(logical_test, value_if_true, value_if_false)

Example — flag amounts over a threshold:

=IF(B2>1000,"High","Low")

If B2 is over 1000, the cell shows "High"; otherwise "Low." The results can be text, numbers, or even other formulas.

Comparisons you can test. Use >, <, >=, <=, =, and <> (not equal). You can compare to a number, text in quotes, or another cell: =IF(B2>C2,"Over budget","OK").

Returning a calculation. The true/false results can be formulas: =IF(B2>0, A2/B2, 0) divides only when it's safe to.

Nested IFs — more than two outcomes. When you need several bands, put an IF inside an IF. Grading by score:

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

Excel checks each condition in order and stops at the first one that's true. Order matters — go from highest to lowest (or most to least specific) so an earlier test doesn't catch a value meant for a later one.

The cleaner option: IFS. Deeply nested IFs are hard to read and easy to break. If your Excel has IFS, it lists conditions and results in pairs:

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

The final TRUE,"F" acts as the catch-all "otherwise."

Combining conditions with AND / OR. To require multiple conditions at once, nest AND; for any-of, use OR:

=IF(AND(B2>1000,C2="Paid"),"VIP","")
=IF(OR(B2="Urgent",C2="Urgent"),"Flag","")

Common pitfalls.

  • Mismatched parentheses. Every IF needs its closing bracket; nested ones stack up fast. Count them, or let a tool build it.
  • Text not in quotes. Words must be quoted ("Paid"); cell references and numbers must not.
  • Overlapping ranges in nested IFs. Put the boundary tests in the right order.

When the logic gets to three or more layers, building it by hand is where errors creep in — that's exactly what the formula builder is for.

Related: How to Use SUMIFS for Multiple Conditions · How to Fix Common Excel Formula Errors