Calculating weighted average in Excel is an important skill for data analysts and number crunchers But many find it confusing
In this comprehensive guide, I’ll walk you through what weighted average is, why it matters, and give actionable tips on calculating it in Excel using formulas, Power Pivot, VBA, and Office Scripts
What is Weighted Average and Why It Matters
Weighted average gives more importance to certain values based on assigned weights. It provides a more accurate measure than simple average.
For example, final grades are often weighted averages. Quizzes, assignments, exams, etc. have different weights based on their importance. Calculating simple average won’t be fair to students.
Weighted average has many uses
- In business, to calculate returns based on capital contribution of partners
- In market research, to evaluate segments based on revenue, market share, etc.
- In project management, to calculate costs based on task effort
- In investing, to determine portfolio returns based on asset allocation
By weighting inputs, weighted average better reflects real-world priorities. Simple averages treat all data equally, even if they shouldn’t be.
Weighted Average Calculation Method
The weighted average is calculated as:
Weighted Average = Sum of (Value x Weight) / Sum of Weights
Let’s see an example.
Test | Score | Weight |
---|---|---|
Quiz 1 | 90 | 5% |
Quiz 2 | 80 | 5% |
Midterm | 75 | 20% |
Quiz 3 | 85 | 5% |
Final | 95 | 30% |
-
Quiz 1: 90 x 0.05 = 4.5
-
Quiz 2: 80 x 0.05 = 4
-
Midterm: 75 x 0.2 = 15
-
Quiz 3: 85 x 0.05 = 4.25
-
Final: 95 x 0.3 = 28.5
-
Sum of (Value x Weight) = 4.5 + 4 + 15 + 4.25 + 28.5 = 56.25
-
Sum of Weights = 0.05 + 0.05 + 0.2 + 0.05 + 0.3 = 0.65
-
Weighted Average = 56.25 / 0.65 = 86.54
So the weighted average is 86.54 compared to simple average of 85.
Calculate Weighted Average in Excel Using Formulas
Excel doesn’t have a dedicated function for weighted average. But you can use SUMPRODUCT and SUM formulas to calculate it.
When Weights Sum to 100
If weights add up to 100, use SUMPRODUCT:
=SUMPRODUCT(values_range, weights_range)
For example:
=SUMPRODUCT(B2:B6,D2:D6)
This multiplies values by weights and returns the sum.
When Weights Don’t Add to 100
If weights don’t add to 100, also use SUM:
=SUMPRODUCT(values_range, weights_range)/SUM(weights_range)
For example:
=SUMPRODUCT(B2:B6,D2:D6)/SUM(D2:D6)
This divides the weighted sum by total weights.
Make sure to use the correct ranges for values and weights in your data.
Calculate Weighted Average Using Excel Power Pivot
You can also calculate weighted average in Power Pivot and visualize it in a pivot table. Here are the steps:
-
Add your data table to the Data Model in Power Pivot.
-
In the Add Column ribbon, add a “Weighted Value” column.
-
Use this DAX formula for weighted value:
=Table1[Value] * Table1[Weight]
-
Add columns for “Sum of Weights” and “Sum of Weighted Values” using SUM.
-
Calculate weighted average with:
=SUM('Weighted Values') / SUM('Weights')
-
Save and close Power Pivot.
-
Create a pivot table from the Data Model.
-
Add the weighted average measure to values area to display it.
This approach lets you easily visualize weighted averages in pivot tables!
Using Excel VBA to Calculate Weighted Averages
If you’re comfortable with VBA, you can create a macro to automate weighted average calculation.
Here are the key steps:
-
Open VBA editor using Alt + F11.
-
Insert a new module and paste this code:
Sub WeightedAverage() Dim total As Double Dim weightTotal As Double total = 0 weightTotal = 0 For i = 2 To lastRow total = total + Cells(i, "B").Value * Cells(i, "C").Value weightTotal = weightTotal + Cells(i, "C").Value Next i Cells(8, "D").Value = total / weightTotal End Sub
-
Modify
B
andC
to your value and weight columns. -
Change
Cells(8, "D")
to the output cell. -
Run the macro using Alt + F8.
This calculates the weighted average and outputs it to a selected cell.
Using Office Scripts to Calculate Weighted Averages
If you have Microsoft 365, Office Scripts is another automated option:
-
In the Automate tab, open a new script.
-
Paste this script:
function main(workbook: ExcelScript.Workbook) { let sheet = workbook.getActiveWorksheet(); sheet.getRange("B8").setFormula(`=SUMPRODUCT(B2:B6,C2:C6)/SUM(C2:C6)`); sheet.getRange("B8").setNumberFormatLocal("0.00"); }
-
Modify ranges to match your data.
-
Save and run the script.
Office Scripts doesn’t require coding knowledge. This automates weighted average calculation in Excel on the web or desktop.
Best Practices for Weighted Averages
Here are some tips for working with weighted averages in Excel:
-
Use dedicated columns for values and weights to avoid confusion.
-
Double check if your weights add up to 1 or 100 to determine which Excel formula to use.
-
Make sure ranges reference your actual data in the workbook.
-
Format cells as percentage to display weights or decimal numbers to display averages.
-
Use Office Scripts or VBA for frequent or large datasets to automate calculation.
-
Visualize weighted averages in pivot tables using the Power Pivot approach.
-
Document your data model so others can understand the calculation.
Common Errors and Solutions
Some common errors and fixes when working with weighted averages:
-
#DIV/0! error – Check for weights summing to zero. Exclude zeros from denominator.
-
#VALUE! error – Verify ranges have no text or blanks. Make sure to lock ranges.
-
Wrong value – Double check correct ranges used for values and weights.
-
Weights don’t add to 1 – Use
SUMPRODUCT/SUM
formula if weights don’t sum to 100%. -
Weights as decimals – Format cells as percentage to enter 5% as 0.05, or divide weights by 100.
Taking a few minutes to correctly setup your weighted average calculation in Excel ensures you get accurate analytics. Use the right formula for your data, leverage Excel’s automation capabilities, and avoid common errors.
Weighing your data properly gives you richer insights from your analyses!
So try these steps to calculate weighted averages in Excel, and put your data to better use for smarter decisions.
Download 100+ Important Excel Functions
Learn Excel with high quality video training. Our videos are quick, clean, and to the point, so you can learn Excel in less time, and easily review key topics when needed. Each video comes with its own practice worksheet.
Weights that do not sum to 1
In the example above, the weights are configured to add up to 1, so the divisor is 1, and the final result is the value returned by SUMPRODUCT. However, a nice feature of the formula is that the weights dont need to add up to 1. For example, we could use a weight of 1 for the first two tests and a weight of 2 for the final (since the final is twice as important) and the weighted average will be the same:
In cell G5, the formula is solved like this:
Note: the values in curly braces {} above are arrays, which map directly to ranges in Excel.
The SUMPRODUCT function requires that array dimensions be compatible to run correctly. For example, if the data is in a horizontal array, the weights should also be in a horizontal array. If dimensions are not compatible, SUMPRODUCT will return a #VALUE error. To prevent this problem, you may need to transpose the weights to match the data. In the example below, the weights are the same as the original example above, but they are listed in a vertical range:
In this case, to calculate a weighted average with the same formula, we need to “flip” the weights into a horizontal array with the TRANSPOSE function like this:
After TRANSPOSE runs, the vertical array:
becomes a horizontal array like this:
Note the semicolons are now commas, which indicate a horizontal array. From this point, the formula is solved the same way as explained earlier. Video:
Author
Hi – Im Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.
How To calculate Weighted Averages in Excel
Is there a weighted average function in Excel?
This is true for the SUMPRODUCT or SUM approach. There is no weighted average function in Excel, but with two simple functions, SUMPRODUCT and SUM, we can easily calculate it ourselves. Related Posts:
How do you calculate a sum of weights in Excel?
So, instead of multiplying each value by its weight individually, you supply two arrays in the SUMPRODUCT formula (in this context, an array is a continuous range of cells), and then divide the result by the sum of weights:
How do you calculate a weighted average?
If you’re using a weight scale like 1 to 10 or 1 to 5 to indicate the priority of the linked value, then you need to divide the SUMPRODUCT value with SUM or the weights. Then, you get the accurate weighted average. The above dataset shows a high school student securing scores in different courses.
How do I find a weighted average in Excel?
Select the cell where the weighted average should go (for us that’s cell D15) and then type the following formula into the function bar. Press “Enter” after typing the formula to view the weighted average. And there you have it. It’s a fairly simple example, but it’s a good one for showing how weighted averages work.