Assigning letter grades to student roster

vanduo

New Member
Joined
Oct 7, 2002
Messages
2
I am teaching large classes and after each test I need to assign letter grades to students’ test scores. Could someone help me out please in writing a macro to do so? Thank you very much.

If student’s score is from 100 to 90 then A
If student’s score is from 89 to 80 then B
If student’s score is from 79 to 70 then C
If student’s score is from 69 to 60 then D
If student’s score is equal to or less then 59 then F

Arunas Juska
East Carolina University
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
if you can get away with a formula, you could use
=IF(LEN(A1),VLOOKUP(A1,{0,"f";60,"d";70,"c";80,"b";90,"a"},2),"")
for a grade in A1. Or if your grades are percents, adjust to
=IF(LEN(A1),VLOOKUP(A1,{0,"f";.6,"d";0.7,"c";0.8,"b";0.9,"a"},2),"")
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
No need for a macro. The VLOOKUP function was desiged for this type of problem. See Example.
Book1
ABCDEFG
1NAMESCOREGRADEScoreGrade
2John78C0F
3Mary85B60D
4Bill93A70C
5Sue58F80B
690A
7
...


HTH - See Help file for more info on VLOOKUP
This message was edited by lenze on 2002-10-08 15:23
 

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
On 2002-10-08 15:10, vanduo wrote:
I am teaching large classes and after each test I need to assign letter grades to students’ test scores. Could someone help me out please in writing a macro to do so? Thank you very much.

If student’s score is from 100 to 90 then A
If student’s score is from 89 to 80 then B
If student’s score is from 79 to 70 then C
If student’s score is from 69 to 60 then D
If student’s score is equal to or less then 59 then F

Arunas Juska
East Carolina University

One solution is to just use a Lookup

=LOOKUP(A2,{0,60,70,80,90;"F","D","C","B","A"})

or edit the following
Function LetterGrade(NumberGrade As Double) As String
'ensure correct results are are thresholds
' may have to adjust ranges such as .9 to .929
Select Case NumberGrade
Case Is > 0.97: LetterGrade = "A+"
Case 0.93 To 0.97: LetterGrade = "A"
Case 0.9 To 0.93: LetterGrade = "A-"
Case 0.87 To 0.9: LetterGrade = "B+"
Case 0.83 To 0.87: LetterGrade = "B"
Case 0.8 To 0.83: LetterGrade = "B-"
Case 0.77 To 0.8: LetterGrade = "C+"
Case 0.73 To 0.77: LetterGrade = "C"
Case 0.7 To 0.73: LetterGrade = "C-"
Case 0.67 To 0.7: LetterGrade = "D+"
Case 0.63 To 0.67: LetterGrade = "D"
Case 0.6 To 0.63: LetterGrade = "D-"
Case Else: LetterGrade = "F"
End Select
End Function
 

Albert 1

Active Member
Joined
Feb 22, 2002
Messages
393
Also possible with a formula.
If the scores are in column A (the first in A2), put in B2:

=IF(ISNUMBER(A2)=FALSE,"",IF(A2<=59,"F",IF(A2<70,"D",IF(A2<80,"C",IF(A2<90,"B","A"))))

and copy down in column B.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,554
Messages
5,596,814
Members
414,104
Latest member
imamalidadashzada

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top