Log in

View Full Version : Convert numerical grade to letter grade in Excel


donf
Jun 10, 2019, 06:16 PM
I need to structure a formula in Excel that will take numerical gradesfrom 90 to 100 =A.
From 80 to 89 = B, From 70 to 79 = C, from 60 to 69 = D and less than or = 59 = F.

I thought you could use an If Then / Else test.

ArcSine
Jun 11, 2019, 12:53 PM
You can. Excel's IF() operates like C's (if this ? then this : otherwise this). Taking advantage of the left-to-right processing of the nested IFs:

=IF(D3 > 89, "A", IF(D3 > 79, "B", IF(D3 > 69, "C", IF(D3 > 59, "D", "F"))))

...replacing "D3" in this example with the cell address containing the numerical grade.

donf
Jun 11, 2019, 01:29 PM
I found the error this afternoon.

Because the numercial grade was presented as a % grade I had to change my IF function value. For example, =IF(L3>=90,"A") became =IF(L3>=0.90,"A") once I did that the entire string worked just fine.

ArcSine
Jun 12, 2019, 05:16 AM
Roger that. Small thing: If you define your breakpoints as 89, 79, ..., as I have in my example, rather than 90, 80, etc., then your inequalities in the formula can be strict ">" rather than of the ">=" form.

Makes for a wee bit shorter code, but OTOH doesn't work if scores like 89.52 are possible (in which case ">= 90" is more foolproof than "> 89.99".