The weighted average formula is helpful when some values in your data are more important than others. Instead of using a regular average where all numbers are treated equally, a weighted average gives more value to certain items based on their weight.
Google Sheets has a built-in function called AVERAGE.WEIGHTED that makes this easy to do. It saves time and avoids mistakes you might make by calculating it manually.
In this article, we’ll learn how to use the weighted average formula in Google Sheets with simple examples and step-by-step instructions.
The AVERAGE.WEIGHTED function is the easiest way to calculate weighted averages in Google Sheets.
Here’s how to apply this method:
➤ Open your dataset in Google Sheets.
➤ Click on a blank cell where you want the weighted average to appear, such as E2.
➤ Type the following formula to calculate the weighted average of Scores in Column B using Weights from Column C.
=AVERAGE.WEIGHTED(B2:B11, C2:C11)
➤ Press Enter.
➤ Now you’ll see the calculated weighted average appear in cell E2.
What Is Weighted Average Formula?
A weighted average is a way to calculate an average that gives more importance to some values over others. Unlike a regular average where each number is treated equally, a weighted average allows you to decide which numbers matter more in the final result.
This method is especially useful when your data points don’t all have the same level of importance. It helps you get a more realistic view of your data by giving extra weight to the values that are more relevant or reliable.
For example you have ten test scores with different weights:
To calculate the weighted average:
= (85×5 + 90×5 + 78×10+ 82×10 + 88×10 + 84×20 + 91×10 + 93×10 + 95×5 + 89×15) / (5 + 5 + 10 + 10 + 10 + 20 + 10 + 10 + 5+ 15)
= (425 + 450 + 780 + 820 + 880 + 1680 + 910 + 930 + 475 + 1335) / 100
= 8,685 / 100 = 86.85
The Generic formula is Weighted Average = (Value1 × Weight1 + Value2 × Weight2 + …) ÷ (Total of Weights)
Using AVERAGE.WEIGHTED Function
In the following dataset, there are three columns labeled Assignment, Score (%), and Weight. Column A lists the names of each assignment, Column B shows the score received for each task, and Column C includes the weight assigned to that task based on its importance.
Column E is currently empty and will be used to display the final weighted average using formulas in Google Sheets.
We’ll use this dataset to apply and practice different methods for calculating the weighted average.
The AVERAGE.WEIGHTED function is the easiest way to calculate weighted averages in Google Sheets. It works by applying the weight to each value and then dividing the total by the sum of the weights.
Here’s how to apply this method:
➤ Open your dataset in Google Sheets.
➤ Click on a blank cell where you want the weighted average to appear, such as E2.
➤ Type the following formula to calculate the weighted average of Scores in Column B using Weights from Column C.
=AVERAGE.WEIGHTED(B2:B11, C2:C11)
➤ Press Enter.
➤ Now you’ll see the calculated weighted average appear in cell E2.
Using SUMPRODUCT Function to Calculate Weighted Average
If you want to calculate a weighted average without using the built-in function, you can apply a combination of SUMPRODUCT and SUM. This method gives the same result and helps understand the underlying logic.
Here’s a simple step-by-step guide to apply this method:
➤ Click on a blank cell in your Google Sheet.
➤ Type this formula
=SUMPRODUCT(B2:B11, C2:C11) / SUM(C2:C11)
➤ Press Enter.
➤ Now you’ll see the weighted average based on the values in Column B and the weights in Column C displayed in cell E2.
Applying Google Apps Script to Calculate Weighted Average
Google Apps Script also helps you calculate the weighted average automatically, without writing any formula in the cells. This method is helpful when you’re working with a large dataset or want to keep your spreadsheet clean by hiding the logic behind the scenes.
Here’s how to do it:
➤ Open your dataset in Google Sheets.
➤ Go to the top Menu and click Extensions >> Apps Script.
➤ Delete any default code in the editor.
➤ Now copy and paste the following script:
function calculateWeightedAverage() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var scores = sheet.getRange("B2:B11").getValues();
var weights = sheet.getRange("C2:C11").getValues();
var total = 0;
var weightSum = 0;
for (var i = 0; i < scores.length; i++) {
var score = scores[i][0];
var weight = weights[i][0];
if (!isNaN(score) && !isNaN(weight)) {
total += score * weight;
weightSum += weight;
}
}
var weightedAverage = total / weightSum;
sheet.getRange("E2").setValue(weightedAverage);
}
➤ Click the Save icon so the Run option becomes active.
➤ Next, click Run to execute the script.
➤ A message saying Execution started will appear at the bottom. If this is your first time using Apps Script, you’ll be asked to grant permission.
➤ Click Continue to allow access to your Google account.
➤ Once the script finishes running, go back to your spreadsheet.
➤ The weighted average will be automatically calculated and displayed in cell E2.
Frequently Asked Questions
Is there a weighted average formula in Google Sheets?
Yes. Google Sheets has a built-in formula called AVERAGE.WEIGHTED that calculates the weighted average automatically.
How to use weighted average in Google Sheets?
To use a weighted average in Google Sheets, the easiest method is with the AVERAGE.WEIGHTED function.
Here’s how to do it:
➤ Open your Google Sheets file and click on a blank cell where you want the result to appear.
➤ Enter the formula like this =AVERAGE.WEIGHTED(B2:B11, C2:C11)
➤ Press Enter. This will calculate the weighted average using values from Column B and weights from Column C.
How do I calculate the weighted mean in Google Sheets?
The weighted mean is just another name for the weighted average. You can calculate it easily using the AVERAGE.WEIGHTED function.
Here’s how to apply this:
➤ Open your Google Sheets and click on a cell where you want the weighted mean to show.
➤ Type the formula =AVERAGE.WEIGHTED(score_range, weight_range)
➤ Replace score_range and weight_range with your actual cell ranges.
➤ Press Enter to see the result.
Wrapping Up
Calculating weighted averages in Google Sheets is very helpful when some data points have more importance. If you are working with grades, survey scores, or any data that uses weights, weighted average formulas help you improve accuracy.
The AVERAGE.WEIGHTED function works fast and well with organized data. For more control, the SUMPRODUCT method is a good option. You can also use Google Apps Script to create custom weighted average calculations for added flexibility.
Using these formulas makes handling weighted data easier and your results clearer and more precise.