Grade Formula in Excel: IF, Nested IF, and IFS

Formulas & functions · Updated November 23, 2026

The most direct way to assign a letter grade in Excel is with a nested IF function, for example: =IF(A1>=90,"A",IF(A1>=80,"B",IF(A1>=70,"C",IF(A1>=60,"D","F")))). This formula checks a numeric score in cell A1 and returns the corresponding letter grade based on standard 90/80/70/60 thresholds.

However, there are several other methods—IFS, VLOOKUP, and LOOKUP—each with advantages depending on your grading scale, how many grades you have, and whether you want to edit the thresholds easily. This article explains each approach, how to choose, common errors, and answers to frequently asked questions.

Why Use a Formula Instead of Typing Grades Manually?

Manually typing letter grades is fine for a one-off assignment, but it becomes error-prone and tedious when you have hundreds of students or multiple assessments. A formula ensures consistency: every score above 89 automatically gets an “A,” and if you change a score, the grade updates instantly. Formulas also make it easy to copy down a column, and they eliminate the risk of typos like “B+” when you meant “B.”

Beyond letter grades, the same logic applies to pass/fail, GPA points, or any categorical label based on a numeric threshold. The underlying principle is the same: map a number to a category using a lookup or conditional test.

The Nested IF Formula: How It Works

The nested IF function is the classic method. It works by testing conditions in order, and the first condition that is TRUE returns its value. For example, with a score in A1:

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

This assumes the grading scale is: 90–100 = A, 80–89 = B, 70–79 = C, 60–69 = D, below 60 = F. The formula checks if A1 is at least 90; if not, it checks if at least 80, and so on. The last value (“F”) is the default if none of the conditions are met.

For example, if A1 contains 85, the formula returns “B” because 85 is not >=90 but is >=80. If A1 contains 59, it returns “F.”

Nested IFs work in all versions of Excel, but they become hard to read and maintain if you have more than a few conditions. Excel allows up to 64 nested IFs, but that is rarely a good idea—it is easy to misplace a parenthesis or make a logic error.

Using IFS for Simpler Logic (Excel 2019 and Later)

The IFS function is a cleaner alternative introduced in Excel 2019 and available in Microsoft 365. It takes pairs of condition and result, and returns the result for the first TRUE condition. The same grade example becomes:

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

The final TRUE acts as a catch-all for any score below 60. If you omit that, and no condition matches, the function returns a #N/A error. This formula is shorter and easier to read than nested IFs, but it requires Excel 2019, Excel 2021, or Microsoft 365. On older versions, you would need to use nested IF or VLOOKUP.

Using VLOOKUP for a Grade Table

If you have a grading scale that might change, or if you want to avoid long formulas, a lookup table is the most maintainable approach. Create a table with two columns: the minimum score for each grade and the letter grade. For example, in cells D1:E5:

  • D1: 0, E1: “F”
  • D2: 60, E2: “D”
  • D3: 70, E3: “C”
  • D4: 80, E4: “B”
  • D5: 90, E5: “A”

Then use VLOOKUP with the last argument set to TRUE (or omitted) to find the closest match that is less than or equal to the score. The formula for a score in A1 would be:

  • =VLOOKUP(A1,$D$1:$E$5,2,TRUE)

The TRUE (or 1) tells Excel to use an approximate match, which finds the largest value in the first column that is less than or equal to A1. For a score of 85, it finds 80 and returns “B.” For a score of 92, it finds 90 and returns “A.” This method is easy to update—just change the table—and it works in every Excel version. The table must be sorted ascending by the first column, otherwise the result is unpredictable.

An alternative is LOOKUP with array constants, but that is less flexible. For example, =LOOKUP(A1,{0,60,70,80,90},{"F","D","C","B","A"}) does the same thing without a table, but the thresholds are hard-coded in the formula, making it harder to edit.

How to Choose the Right Method

Your choice depends on your Excel version, how often the scale changes, and how many grades you have. Here are some general guidelines:

  • If you use Excel 2019 or newer and have a simple scale (like 5–6 grades), use IFS—it is the easiest to read and type.
  • If you use an older version or expect to adjust the thresholds frequently, use VLOOKUP with a table. It is the most maintainable and works everywhere.
  • If you have only two outcomes (pass/fail), a single IF is enough: =IF(A1>=60,"Pass","Fail").
  • If you want to assign GPA points (e.g., A=4, B=3), you can use the same methods but with numeric results instead of letters.

For very complex scales with plus/minus (A+, A, A-, etc.), a lookup table is almost always better because the formula would become unwieldy. For example, a table with 11 rows (A+ through F) is easier to manage than an 11-level nested IF.

Common Problems and How to Fix Them

Several issues frequently arise when writing grade formulas:

  • #N/A error in VLOOKUP: This happens when the score is lower than the smallest value in the table (e.g., below 0). Ensure your table starts with 0 or a negative number, or wrap the formula in IFERROR to return a custom message like "Invalid".
  • Wrong grade due to unsorted table: VLOOKUP with TRUE requires the first column to be sorted ascending. If your table is not sorted, you might get incorrect results. Always sort the table by the minimum score column.
  • IFS returns #N/A: This occurs when no condition is TRUE and you omitted the final TRUE catch-all. Add TRUE,"F" (or your default) at the end.
  • Text grades instead of numbers: If your scores are stored as text (e.g., “85”), the formula may not work. Convert them to numbers by selecting the cells and using the warning icon, or by multiplying by 1 (e.g., =A1*1).
  • Boundary values: Decide whether a score of 89.5 rounds up or stays a B. The formulas above use >=, so 89.5 would be a B because it is not >=90. If you want to round first, use =IF(ROUND(A1,0)>=90,...).

Another common misconception is that you need a formula for every letter grade. In reality, a single formula copied down a column handles all students. Also, remember that Excel treats empty cells as 0, so if you have a blank score, the formula will return an “F” or “Invalid.” You might want to add an IF(A1="","",...) to leave the cell blank until a score is entered.

Frequently Asked Questions

Can I use a formula to assign grades based on a curve?

Yes, but you need to calculate the curve first. For example, if you want to add 5 points to every score, use =IF(A1+5>=90,...) or adjust the lookup table. For a statistical curve (like mean + standard deviation), you would compute the thresholds using AVERAGE and STDEV.P, then reference those cells in your formula. This is more advanced but doable.

What if my grading scale uses plus/minus (e.g., A-, B+)?

You can use a lookup table with more rows. For example, list 80 for B-, 83 for B, 87 for B+, and so on. The VLOOKUP method works the same way. Just ensure the table is sorted and includes all thresholds. The formula remains the same—only the table changes.

Does the formula work in Google Sheets?

Yes, the same functions (IF, IFS, VLOOKUP) exist in Google Sheets with the same syntax. The only difference is that in Google Sheets, you use a comma as the argument separator (same as Excel), and the IFS function is available in all versions. The steps are identical.

How do I convert letter grades to GPA points?

You can use a nested IF or a lookup table. For example, to convert A=4, B=3, C=2, D=1, F=0, with the letter in B2, use =IF(B2="A",4,IF(B2="B",3,IF(B2="C",2,IF(B2="D",1,0)))). Or use a table with letters in one column and points in another, then use VLOOKUP with FALSE (exact match).

Why does my formula return #VALUE!?

This usually means the score cell contains text or an error. Check that the cell contains a number and not a formula that returns text. Also ensure you don’t have extra spaces in your formula. If the score is a result of another formula, make sure that formula returns a number.

Can I use conditional formatting to color grades instead of a formula?

Yes, you can use conditional formatting to highlight cells based on the grade value. For example, select the grade column, go to Home > Conditional Formatting > Highlight Cells Rules > Equal To, and enter “A” to highlight all A’s. You can also use a formula rule to color based on the score, but that is separate from assigning the grade.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.