Others

Calculate a Weighted Grade Average in Microsoft Access Without Penalizing Missing Scores

Aamir Naveed AkramAamir Naveed Akram Nov 20, 2026 869 views

Question details

Calculate a student's weighted grade average using only scores that are present.

Calculate a Weighted Grade Average in Microsoft Access Without Penalizing Missing Scores
Product
Microsoft Access
Device & OS
not provided
Scenario
An Access query combines homework, midterm, and exam scores with different weights.
Observed behavior
Missing scores should be excluded from both the weighted total and the sum of applicable weights, so they do not lower the average.
Before you start

Check the table and field names in your Access database, and confirm that missing scores are stored as Null rather than zero. Use the same grading scale for all three score fields.

Solution 1Recommended

Create an Access query that excludes missing grade weights

Use this query when each student's homework, midterm, and exam scores are stored in separate fields.

The numerator uses Nz to substitute zero for a missing score. The denominator adds a category's weight only when its score is not Null.

The WHERE clause excludes students with no scores, preventing division by zero. A score of zero is still counted because it is not Null.

1
Open SQL View

In Access, select Create > Query Design, then switch to View > SQL View.

2
Enter the weighted-average query

Paste this SQL: SELECT [StudentID], (0.3*Nz([Homework],0) + 0.2*Nz([MidtermTest],0) + 0.5*Nz([Exam],0)) / (IIf([Homework] Is Null,0,0.3) + IIf([MidtermTest] Is Null,0,0.2) + IIf([Exam] Is Null,0,0.5)) AS [WeightedAverage] FROM [Grades] WHERE [Homework] Is Not Null OR [MidtermTest] Is Not Null OR [Exam] Is Not Null;

3
Match your database

Replace [Grades], [StudentID], and the score field names with those in your database. Change the weights if your grading scheme differs.

4
Run and check the query

Select Run and check a student with a missing score. For example, homework 80 and exam 90 with a missing midterm produce 86.25 using the weights above.

Access Boolean values: Access represents True as -1. Multiplying a positive weight directly by Not IsNull([Score]) can therefore produce a negative denominator; the IIf expressions above avoid that issue.
Free Microsoft Office alternative

Calculate weighted grades in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface. It cannot run or repair an Access query, but you can calculate equivalent weighted averages in a spreadsheet and move existing Excel files into WPS.

  1. 1. Enter the weights: In WPS Spreadsheets, enter 30%, 20%, and 50% in cells B1, C1, and D1.
  2. 2. Enter the scores: Enter homework, midterm, and exam scores in B2:D2. Leave missing scores blank and enter actual zero scores as 0.
  3. 3. Calculate the average: In E2, enter =IF(COUNT(B2:D2)=0,"",SUMPRODUCT(B2:D2,$B$1:$D$1)/SUMPRODUCT(--ISNUMBER(B2:D2),$B$1:$D$1)). Copy the formula down for other students.
Calculate weighted grades while excluding blank score cells.Open and edit Microsoft Excel formats, including XLSX.Use a familiar spreadsheet interface for an easier transition.Work with a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

What happens if all three scores are missing?

The Access query's WHERE clause excludes that student, so it never divides by zero. Use a separate report or query if you also need to list students with no scores.

Does a score of zero count toward the average?

Yes. The query checks Is Null, so a numeric zero is included along with its weight. Leave a genuinely missing score Null if it should be excluded.

Can I change the grade weights?

Yes. In SQL View, replace 0.3, 0.2, and 0.5 in both the numerator and the corresponding IIf expressions in the denominator. Use positive weights for the categories you want to include.

Why did using Not IsNull produce a negative average?

In Access, True is represented by -1. A positive weight multiplied directly by Not IsNull([Score]) can make the denominator negative. Use IIf([Score] Is Null,0,weight) to return a positive weight for a present score.