Convert a score into a letter grade (nested IF)

Medium Logic
Description
Hints 0/3
Solutions 1
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

It's report-card season: exam scores are already entered, and the school system needs a letter grade beside each one. Fill the Letter cell B2 with a grade for the score in A2: A for scores ≥90, B for ≥80, C for ≥70, otherwise D.

Test the highest threshold first — case 2 scores 94 and must not fall through to B.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
AB
1 ScoreLetter
2 87

Notes

Evaluate thresholds from high to low. Modern Excel also offers IFS, but nested IF remains the interview classic.

How to approach

Your answer goes in B2. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.

  1. Start with IF(A2>=90,"A", ...)
  2. Nest the next IF for the 80 threshold
  3. The final false branch should return "D"

Official solutions

Show 1 solution — try it yourself first

Approach 1: Top-down nested IF logic

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

Evaluates from highest grade to lowest: checks ≥90 for A, then ≥80 for B, then ≥70 for C, defaulting to D for anything below 70.

Function guide

Related practice

FAQ

How do I build a nested IF letter grade formula?

Evaluate high to low, for example =IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","D"))).

Can I use IFS instead of nested IF?

Yes in modern Excel and Google Sheets. Nested IF is still useful for interviews and older workbooks.