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.
by Allen Wyatt
(last updated July 15, 2017)
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:
Figure 1. The Insert Calculated Field dialog box.
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.
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!
PivotTables are great for digesting and analyzing huge amounts of data. But what if you want part of that data excluded, ...Discover More
If you are using a data set that includes a number of zero values, you may not want those values to appear in a ...Discover More
When you create a PivotTable, it can have a name. You may want this name to appear within the PivotTable itself. There is ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.