Excel AI App
Open App
FormulasExcelHow-to· 7 min read · Updated July 27, 2026

The Excel IF Formula, Explained: Nested IF, IFS, AND & OR

Quick answer

Use =IF(test, value_if_true, value_if_false) for one condition. For several, either nest IFs or use the cleaner =IFS(test1, result1, test2, result2, TRUE, default). Combine conditions with AND(...) for 'all true' and OR(...) for 'any true'.

By The Excel AI App Team

The IF function is the decision-maker of the spreadsheet world: “if this is true, do this; otherwise, do that.” Master it — plus its cleaner cousin IFS and the AND/OR helpers — and you can express almost any business rule.

The essentials: =IF(test, value_if_true, value_if_false) for one condition; IFS(...) for many; AND(...)/OR(...) to combine conditions. Build any of these with our IF formula builder.

The basic IF

Three arguments: the test, the result if true, the result if false.

=IF(A1>=60, "Pass", "Fail")

Text results go in quotes; numbers and cell references don’t. You can return a calculation, too, e.g. =IF(A1>100, A1*0.9, A1).

Nested IF for multiple outcomes

Chain IFs by placing another IF in the “false” slot:

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

Order matters — the formula stops at the first true test, so list conditions from most to least restrictive. Excel allows up to 64 nested IFs, but past three or four it becomes hard to read and easy to mis-parenthesize.

IFS: the readable alternative

IFS lists condition/result pairs flatly. End with TRUE as the catch-all:

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

IFS is available in Excel 2019+/365 and Google Sheets. For older Excel, stick with nested IF.

Combining conditions with AND and OR

  • AND — all conditions must be true: =IF(AND(A1>=60, B1="Yes"), "Approve", "Reject")
  • OR — any condition true: =IF(OR(A1="VIP", B1>1000), "Priority", "Standard")

Handle errors and blanks

Wrap risky formulas in IFERROR to replace ugly errors: =IFERROR(A1/B1, 0). Test for empty cells with =IF(A1="", "Missing", A1).

When to stop nesting

If you’re mapping many inputs to many outputs (say, region → tax rate), a lookup table with VLOOKUP or XLOOKUP is cleaner and easier to maintain than a long IF chain. And to skip the syntax entirely, let AI write the formula.

Frequently asked questions

What is the IF formula in Excel?

=IF(logical_test, value_if_true, value_if_false). It returns one value when the test is TRUE and another when it's FALSE — for example =IF(A1>=60, "Pass", "Fail").

How do I write an IF with multiple conditions?

Nest IFs — =IF(A1>=90,"A",IF(A1>=80,"B","C")) — or use IFS for readability: =IFS(A1>=90,"A",A1>=80,"B",TRUE,"C"). Use AND/OR inside IF when conditions must combine.

When should I use IFS instead of nested IF?

Use IFS when you have three or more conditions and you're on Excel 2019+/365 or Google Sheets. It's flatter, easier to read, and avoids parenthesis-counting mistakes. Add a final TRUE for the default case.

Keep exploring

Free Tool
IF Formula Builder
Free Tool
SUMIF / COUNTIF Generator
Guide
Write Formulas with AI
Guide
VLOOKUP vs XLOOKUP

Analyze a whole spreadsheet with AI

Upload an Excel or CSV file and get pivots, outlier detection, and Smart BI dashboards in seconds. Free to start — no credit card.

Open the App Free