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

Weighted Averages in a PivotTable

Written by Allen Wyatt (last updated April 29, 2021)
This tip applies to Excel 2007, 2010, 2013, and 2016


2

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. Select any of the cells in the PivotTable.
  2. On the ribbon, make sure the Options tab (Excel 2007 and Excel 2010) or the Analyze tab (Excel 2013 and Excel 2016) is displayed.
  3. Display the Insert Calculated Field dialog box. (If you are using Excel 2007, in the Tools group click the Formulas tool and then choose Calculated Field. If you are using Excel 2010 or a later version, in the Calculations group click the Fields, Items & Sets tool and then choose Calculated Field.) (See Figure 1.)
  4. Figure 1. The Insert Calculated Field dialog box.

  5. In the Name box, enter a name for your new field.
  6. 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.)
  7. 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 (7129) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel 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

Finding and Replacing Text Boxes

The Find and Replace capabilities of Word are very powerful, but they still come up a bit short when searching for some ...

Discover More

Spelling Errors on Internet Addresses

Tired of Word marking Internet addresses as spelling errors? You can turn off this check by applying the steps in this tip.

Discover More

Aligning Borders with the Page Margins

Add a border to a paragraph and you may find that it extends to the left and right of the regular text margins. To pull ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Default Formatting for PivotTables

Wish there was a way to define how you want PivotTables formatted before you actually create the PivotTable? You may be ...

Discover More

Editing PivotTables without Underlying Data

If you ever try to edit a PivotTable and get an error that tells you that the "underlying data was not included," it can ...

Discover More

Seeing What Changed in a PivotTable

PivotTables are great for aggregating and analyzing tons of raw data. If you want to see what changes in the PivotTable ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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}] (all 7 characters, in the sequence shown) 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 one less than 9?

2017-07-18 14:53:46

Gary

This tip would be much more helpful if specific examples were included. A selection of cells with headings and values and/or formulas could be shown from the original worksheet and another selection of cells from the pivot table could be shown. Thank you.


2017-07-18 03:00:00

Lars

"In the Formula box, enter the formula you want used for your weighted average, such as =WeightedValue/Weight", that brings me back to the original Value?
Or have I missed something?


This Site

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

Newest Tips
Subscribe

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

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.