A weighted grade is the sum of each score times its weight, divided by the sum of the weights. It is not the ordinary average.
The workbook that holds a class of these rows is the teacher gradebook.
84, not 85
SUMPRODUCT multiplies the pairs and adds them. SUM of the weights is the divisor.
=SUMPRODUCT(B2:B3,C2:C3)/SUM(C2:C3)| A | B | C | |
|---|---|---|---|
| 1 | Part | Score | Weight |
| 2 | Exam | 90 | 40 |
| 3 | Homework | 80 | 60 |
| 4 | Weighted | 84 |
90 × 40 = 3,600. 80 × 60 = 4,800. 3,600 + 4,800 = 8,400. 8,400 / 100 = 84.
AVERAGE ignores the weight column.
=AVERAGE(B2:B3)| A | B | C | |
|---|---|---|---|
| 1 | Part | Score | Weight |
| 2 | Exam | 90 | 40 |
| 3 | Homework | 80 | 60 |
| 4 | Average | 85 |
(90 + 80) / 2 = 85. That 85 is the wrong grade for this course. The homework is worth more than the exam, and the average treats them as the same size.
Weights of 0.40 and 0.60 return the same 84, because 36 + 48 = 84 and the weights sum to 1. The divisor is whatever the weights actually sum to. Weights of 40 and 50 sum to 90. 90 × 40 + 80 × 50 = 7,600, and 7,600 / 90 is 84.444…, which a two-decimal format shows as 84.44. Dividing that 7,600 by 100 instead would show 76, which is a different course.
A weight total of 0 makes the division #DIV/0!. xl.weighted.average returns #N/A in that case, so a blank weight does not look like a real zero average. The name needs Microsoft 365, Excel 2024, or Excel for the web. Excel 2021 returns #NAME? for LAMBDA. The SUMPRODUCT form above does not need it.
The letter
LOOKUP finds the last band that is less than or equal to the score. The first column has to stay sorted ascending. LOOKUP will not tell you if it is not.
=LOOKUP(D2,A2:A6,B2:B6)| A | B | C | D | |
|---|---|---|---|---|
| 1 | At least | Letter | Score | |
| 2 | 0 | F | 84 | |
| 3 | 60 | D | B | |
| 4 | 70 | C | ||
| 5 | 80 | B | ||
| 6 | 90 | A |
84 is past 80 and not yet 90, so the letter is B. 86 is also B on this table. That is the same letter the IFS page returns for 86, from bands that run 90, 80, 70, and 60. The 0 band is here so a score under 60 is F instead of #N/A. A score under 0 is still #N/A, because nothing in the list is that small.
Put 90 at the top of an unsorted list and LOOKUP can return the wrong letter with no error. Sort the bands, or use XLOOKUP with an exact match on a letter you have already decided.