Excel Lessons

Make a grade book in Excel: averages, grades and ranks

A grade book that works out each student's average, grade and rank by itself. Weighted marks, grade bands with a lookup, and a missing-mark check.

Published . 7 min read.

By Ali, Founder, Excel Lessons

A grade book in Excel needs 3 formulas for each student. SUMPRODUCT works out the weighted mark. XLOOKUP finds the grade in a band table. RANK.EQ gives the rank. Add a check for missing marks, and the sheet grades every student by itself.

This one is for an evening course with 6 students. Homework counts for 20%, the midterm test for 30% and the final exam for 50%. Dana missed the final exam. Type the marks in A1 to D8.

Row ABCDEFG
1 StudentHomeworkMidtermFinalMarkGradeRank
2 Weight20%30%50%
3 Amara787281
4 Bilal554852
5 Chen928890
6 Dana6470
7 Emil706672
8 Farah857983

The weights are in row 2, in their own cells. Check them with =SUM(B2:D2). It must give 1, which is 100%. If somebody changes a weight, this is the cell that tells you.

Step 1: the weighted mark

AVERAGE is the wrong function here. =AVERAGE(B3:D3) gives 77 for Amara. It treats the homework and the final exam as equal, and they are not.

In E3, type =SUMPRODUCT(B3:D3,$B$2:$D$2). It gives 77.7.

SUMPRODUCT multiplies each mark by its weight and adds the results. That is 78 times 20%, plus 72 times 30%, plus 81 times 50%.

The weights have dollar signs, so they stay on row 2 when you fill the formula down. The marks do not, so they move to each student's row. The SUMPRODUCT article has more uses for it.

Step 2: the missing-mark check

Fill E3 down to E8 and look at Dana. The formula gives 33.8, an F. SUMPRODUCT treats her empty final exam as 0.

AVERAGE is wrong the other way. =AVERAGE(B6:D6) gives 67, a C. It skips the empty cell, so the missing exam simply does not count. Neither number is her mark.

In E3, type =IF(COUNT(B3:D3)<3,"",ROUND(SUMPRODUCT(B3:D3,$B$2:$D$2),1)) and fill it down.

COUNT counts the marks in the row. With fewer than 3, the cell stays empty. Dana's row now shows nothing, which is true: she has no mark yet.

ROUND keeps 1 decimal place in the value, not only on screen. The next step explains why that matters.

To count the gaps in the whole sheet, type =COUNTBLANK(B3:D8) somewhere below. It gives 1. Before you print the grades, it should give 0.

Step 3: the grade from a band table

Type the band table in I1 to J6. Each row says where a grade starts. A mark of 70 or more is a B, until 80, where A starts.

Row I J
1 FromGrade
2 0F
3 50D
4 60C
5 70B
6 80A

In F3, type =IF(E3="","",XLOOKUP(E3,$I$2:$I$6,$J$2:$J$6,,-1)). It gives B.

The -1 means "exact, or the next smaller value". 77.7 is not in the table. So XLOOKUP takes 70, and 70 is a B.

XLOOKUP needs Excel 2021 or later, or Microsoft 365. In older versions, use =VLOOKUP(E3,$I$2:$J$6,2,TRUE). It gives the same grades, but the band table must be sorted from low to high.

Emil's mark is 69.8, so he gets a C. Here is why Step 2 rounds the value. Say the sheet showed marks with no decimals, and the formula did not round. Emil would see 70 on the page and a C next to it. Decide how many decimals you show, and round to the same number in the formula.

The approximate match article has more band tables, for discounts and for tax.

Step 4: the rank

In G3, type =IF(E3="","",RANK.EQ(E3,$E$3:$E$8)). It gives 3.

RANK.EQ gives 1 to the highest mark. Amara's 77.7 is the third highest. Dana's empty cell is text, and RANK.EQ skips it.

RANK.EQ works in Excel 2010 and later. Two equal marks get the same rank, and the next rank is skipped. So two students on 77.7 would both be 3rd, and nobody would be 4th.

The finished columns

Fill E3:G3 down to row 8. Columns E to G now show this.

StudentMarkGradeRank
Amara77.7B3
Bilal51.4D5
Chen89.8A1
Dana
Emil69.8C4
Farah82.2A2

Type Dana's final exam mark in D6 and her row fills in by itself. The ranks below her move down by one.

A summary for the class

  • Class average: =AVERAGE(E3:E8) gives 74.18. It skips Dana's empty cell, so it is the average of 5 students.
  • Number of A grades: =COUNTIF(F3:F8,"A") gives 2.
  • Average mark of the A students: =AVERAGEIF(F3:F8,"A",E3:E8) gives 86.
  • Missing marks: =COUNTBLANK(B3:D8) gives 1.

What goes wrong in real grade books

A grade typed over a formula. Somebody changes one grade by hand after a talk with a student. Next term the formula is gone and that cell never updates. Keep changes in their own column with a note.

Weights inside the formula. =B3*0.2+C3*0.3+D3*0.5 gives the same 77.7. But when the weights change, you must edit every row. Keep them in cells, as in row 2.

A band table without dollar signs. Fill the grade down and the table moves with it. The rows further down look up a smaller table and can give #N/A. The first rows look fine, so the mistake is easy to miss.

The grade book lesson builds a similar sheet with VLOOKUP. Each lesson is a real sheet you type into, and each answer is checked when you press Enter.

Related articles