End of semester grading VBA module

In spite of learning management systems making assigning letter grades simpler, these systems still leave much to be desired when asked to incorporate extra credit or curving of an assessment grade.  To overcome this drawback, I download the grades to a excel spreadsheet and calculate the overall score of each student.  Based on the overall score, one needs to then assign a letter grade for the transcripts.  To assign 13 different plus/minus grading letters manually can be a good candidate for making a mistake in a large size class.  So I use a VBA code (how to access VBA editor) to assign letter grades.

c1 = overall percentage score
fungrade = letter grade

Autar Kaw, End of semester grading VBA module, last retrieved at https://autarkaw.wordpress.com/2015/12/21/end-of-semester-grading-vba-module/, December 21, 2015.

Function fungrade (c1 As Integer) As String
Dim gra As String
Select Case c1
Case Is >= 98
gra = “A+”
Case Is >= 90
gra = “A”
Case Is >= 86
gra = “A-”
Case Is >= 83
gra = “B+”
Case Is >= 80
gra = “B”
Case Is >= 76
gra = “B-”
Case Is >= 73
gra = “C+”
Case Is >= 70
gra = “C”
Case Is >= 66
gra = “C-”
Case Is >= 63
gra = “D+”
Case Is >= 60
gra = “D”
Case Is >= 56
gra = “D-”
Case Is >= 0
gra = “F”
End Select
fungrade = gra
End Function

PS. You can modify the above given VBA code as needed.  If you want a less hard-coded version, you can modify by having two more inputs – 1) a vector of lowest limit of score for a particular letter grade, and 2) a corresponding vector of the same length of letter grades.

This post is brought to you by


Published by

Autar Kaw

Autar Kaw (http://autarkaw.com) is a Professor of Mechanical Engineering at the University of South Florida. He has been at USF since 1987, the same year in which he received his Ph. D. in Engineering Mechanics from Clemson University. He is a recipient of the 2012 U.S. Professor of the Year Award. With major funding from NSF, he is the principal and managing contributor in developing the multiple award-winning online open courseware for an undergraduate course in Numerical Methods. The OpenCourseWare (nm.MathForCollege.com) annually receives 1,000,000+ page views, 1,000,000+ views of the YouTube audiovisual lectures, and 150,000+ page views at the NumericalMethodsGuy blog. His current research interests include engineering education research methods, adaptive learning, open courseware, massive open online courses, flipped classrooms, and learning strategies. He has written four textbooks and 80 refereed technical papers, and his opinion editorials have appeared in the St. Petersburg Times and Tampa Tribune.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s