Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Weighted Averages in a PivotTable.

# Weighted Averages in a PivotTable

by Allen Wyatt
(last updated July 13, 2015)

A good example of how to use calculated fields is for summarizing data differently than you can normally summarize it with a PivotTable. When you create a PivotTable, you can use several different functions to summarize the data that is displayed. For instance, you can create an average of data in a particular field. What if you want to create a weighted average, however? Excel doesn't provide a function that automatically allows you to do this.

When you have special needs for summations—like weighted averages—the easiest way to achieve your goal is to add an additional column in the source data as an intermediate calculation, and then add a calculated field to the actual PivotTable.

For example, you could add a "WeightedValue" column to your source data. The formula in the column should multiply the weight times the value to be weighted. This means that if your weight is in column C and your value to be weighted is in column D, your formula in the WeightedValue column would simply be like =C2*D2. This formula will be copied down the entire column for all the rows of the data.

You are now ready to create your PivotTable, which you should do as normal with one exception: you need to create a Calculated Field. Follow these steps:

1. Click the down arrow next to the word PivotTable at the left side of the PivotTable toolbar. Excel displays a menu.
2. Choose Formulas | Calculated Fields. Excel displays the Insert Calculated Field dialog box. (See Figure 1.)
3. Figure 1. The Insert Calculated Field dialog box.

4. In the Name box, enter a name for your new field.
5. In the Formula box, enter the formula you want used for your weighted average, such as =WeightedValue/Weight. (You use field names in the formula; you can select them from the field list at the bottom of the Insert Calculated Field dialog box.)
6. Click OK.

Your calculated field is now inserted, and you can use the regular summation functions to display a sum of the calculated field; this is your weighted average.

Since there are many different ways that weighted averages can be calculated, it should go without saying that you can modify the formulas and steps presented here to reflect exactly what you need done with your data.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2900) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Weighted Averages in a PivotTable.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Resizing a Text Box

Text boxes allow you to "segment" information in your document and lay it out differently. You can easily resize these ...

Discover More

Returning Zero when a Referenced Cell is Blank

Reference a cell in a macro, and if that cell is blank Excel normally equates that to a zero value. What if you don't ...

Discover More

Changing Tabs Using the Ruler

Need to adjust the position of tab stops in a paragraph? One simple way to do it is to just drag them around on the ruler.

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

Formatting a PivotTable

You can format PivotTables using either manual formatting or automatic formatting. You need to be careful, however, as ...

Discover More

Reducing File Sizes for Workbooks with PivotTables

Need to reduce the size of your workbooks that contain PivotTables? Here's something you can try to minimize the ...

Discover More

Missing PivotTable Data

Wonder what happened to the data behind a PivotTable? It could be in a number of places, and tracking it down could be a ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 - 7?

2017-07-26 18:52:44

Qianjie

I agree with Igor. This tip is not weighted average at all.
I googled everywhere but very few are helpful. I worked it out eventually.
Let's say in raw data sheet, column 1 is your weight, column 2 is your value.
First, you need to create one helper column (co1omn 1 * column 2) into your raw data, if your raw data is linked to the server somewhere, you need to use the SQL querry to add this helper column to your raw data.
Second, create a Calculated Field in the PivotTable: CF = sum(helper column) / sum(column 1)
Then show sum CF in your PivotTable. That sum CF is the weight average!!

2017-04-06 04:16:06

Igor

I am not so sure this can be considered a weighted average though.
To the best of my knowledge a weighted average formula looks like
(v1*wv1)+(v2*wv2)+...+(vn*wvn)/Sum v1-to-n

The division is the tricky part, as it needs to aggregate data spread across several rows, whereas one of the limitations of calculated fields is that they are done row-by-row.

If you have any advice, would be happy to hear.

2016-08-24 13:18:54

IA

Your suggestion worked perfectly for me. Thanks!

2016-03-21 06:53:05

Declan

Can i put a weighted average as a subtotal and/or grand total in a pivot table?
Your tip only gives me the total weighted value, how do i get to put the average of the total weighted value into the grand total or subtotal row?

2015-05-18 15:49:11

Drew

2015-05-01 16:25:02

reinhold23

Thanks, this worked great!

2014-05-28 15:18:20

Peter

This method produced valid results for me. Many thanks.

2013-08-21 10:55:24

Panther68

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.