FormulaCraft

How to write a nested IF formula in Excel and Google Sheets

Topic:IF, IFS & nested conditions
Excel & Google Sheets
=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","F")))

Verified example

Computed by a real spreadsheet engine on the sample data below.

ScoreGrade
95
82
74
55

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

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Decide the order of conditions — always test from most restrictive to least restrictive. For grades: check 90+ first, then 80+, then 70+.
  2. 2Build the formula from the inside out: start with the innermost IF and wrap each condition. Example: =IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","F"))).
  3. 3Press Enter. Each condition is evaluated in order; the first TRUE condition's value is returned. The last value ("F") is the default when no condition matches.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

How many IFs can I nest?

Excel and Google Sheets allow up to 64 levels of nesting, but more than 4–5 levels becomes very hard to read and debug.

What is the IFS function and when should I use it instead?

IFS(condition1, value1, condition2, value2, …) is a cleaner alternative to nested IFs when you have many conditions. It is available in Excel 2019+ and all versions of Google Sheets.

More on IF, IFS & nested conditions

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: