 • Print
This chapter is from the book

## Changing the Calculation in a Value Field

The Value Field Settings dialog offers 11 options on the Summarize Values As tab and 15 main options on the Show Values As tab. The options on the first tab are the basic Sum, Average, Count, Max, and Min options that are ubiquitous throughout Excel; the 15 options under Show Values As are interesting ones such as % of Total, Running Total, and Ranks.

For Excel 2010 only, these options appeared as two drop-down menus in the ribbon. They are not on the Excel 2016 ribbon, but they still exist in the right-click menu. Because many of the calculations require one or two additional settings, you end up back in an extra dialog anyway. If you get in the habit of using the Value Field Settings dialog, you will have access to all the settings in one dialog.

Six of the Show Values As calculations were introduced in Excel 2010, including % of Parent Item, Rank, and % Running Total In.

The following examples show how to use the various calculation options. To contrast the settings, you can build a pivot table where you drag the Revenue field to the Values area nine separate times. Each one shows up as a new column in the pivot table. Over the course of the rest of the chapter, you will see the settings required for the calculations in each column.

To change the calculation for a field, select one value cell for the field and click the Field Settings button on the Analyze tab of the ribbon. The Value Field Settings dialog is similar to the Field Settings dialog, but it has two tabs. The first tab, Summarize Values By, contains Sum, Count, Average, Max, Min, Product, Count Numbers, StdDev, StdDevP, Var, and VarP. You can choose 1 of these 11 calculation options to change the data in the column. In Figure 3.29, columns B through D show various settings from the Summarize Values By tab.

Column B is the default Sum calculation. It shows the total of all records for a given market. Column C shows the average order for each item by market. Column D shows a count of the records. You can change the heading to say # of Orders or # of Records or whatever is appropriate. Note that the count is the actual count of records, not the count of distinct items.

Far more interesting options appear on the Show Values As tab of the Value Field Settings dialog, as shown in Figure 3.30. Fifteen options appear in the drop-down. Depending on the option you choose, you might need to specify either a base field or a base field and a base item. Columns E through J in Figure 3.29 show some of the calculations possible using Show Values As.

Table 3.1 summarizes the Show Values As options.

#### Table 3.1 Calculations in Show Value As

 Show Value As Additional Required Information Description No Calculation None % of Grand Total None Shows percentages so all the detail cells in the pivot table total 100% % of Column Total None Shows percentages that total up and down the pivot table to 100% % of Row Total None Shows percentages that total across the pivot table to 100% % of Parent Row Total None With multiple row fields, shows a percentage of the parent item’s total row % of Parent Column Total None With multiple column fields, shows a percentage of the parent column’s total Index None Calculates the relative importance of items % of Parent Total Base Field only With multiple row and/or column fields, calculates a cell’s percentage of the parent item’s total Running Total In Base Field only Calculates a running total % Running Total In Base Field only Calculates a running total as a percentage of the total Rank Smallest to Largest Base Field only Provides a numeric rank, with 1 as the smallest item Rank Largest to Smallest Base Field only Provides a numeric rank, with 1 as the largest item % of Base Field and Base Item Expresses the values for one item as a percentage of another item Difference From Base Field and Base Item Shows the difference of one item compared to another item or to the previous item % Difference From Base Field and Base Item Shows the percentage difference of one item compared to another item or to the previous item

The capability to create custom calculations is another example of the unique flexibility of pivot table reports. With the Show Data As setting, you can change the calculation for a particular data field to be based on other cells in the Values area.

The following sections illustrate a number of Show Values As options.

### Showing Percentage of Total

In Figure 3.29, column E shows % of Total. Jade Miller, with \$2.1 million in revenue, represents 31.67% of the \$6.7 million total revenue. Column E uses % of Column Total on the Show Values As tab. Two other similar options are % of Row Total and % of Grand Total. Choose one of these based on whether your text fields are going down the report, across the report, or both down and across.

### Using % Of to Compare One Line to Another Line

The % Of option enables you to compare one item to another item. For example, in the current data set, Anne was the top sales rep in the previous year. Column F shows everyone’s sales as a percentage of Anne’s. Cell E7 in Figure 3.31 shows that Jeff’s sales were almost 58% of Anne’s sales. Figure 3.31 This report is created using the % Of option with Anne Troy as the Base Item.

To set up this calculation, choose Show Values As, % Of. For Base Field, choose Rep because this is the only field in the Rows area. For Base Item, choose Anne Troy. The result is shown in Figure 3.31.

### Showing Rank

Two ranking options are available. Column G in Figure 3.32 shows Rank Largest to Smallest. Jade Miller is ranked #1, and Sabine Hanschitz is #12. A similar option is Rank Smallest to Largest, which would be good for the pro golf tour.

To set up a rank, choose Value Field Settings, Show Values As, Rank Largest to Smallest. You are required to choose base field. In this example, because Rep is the only row field, it is the selection under Base Field.

These rank options show that pivot tables have a strange way of dealing with ties. I say strange because they do not match any of the methods already established by the Excel functions =RANK(), =RANK.AVG(), and =RANK.EQ(). For example, if the top two markets have a tie, they are both assigned a rank of 1, and the third market is assigned a rank of 2.

### Tracking Running Total and Percentage of Running Total

Running total calculations are common in reports where you have months running down the column or when you want to show that the top N customers make up N% of the revenue. The Running Total In calculation has been in Excel for many versions. The % Running Total In setting was added in Excel 2010.

In Figure 3.33, cell I8 shows that the top four sales reps account for 76.97% of the total sales.

To specify Running Total In (as shown in Column H) or % Running Total In (Column J), select Field Settings, Show Values As, Running Total In. You have to specify a base field, which in this case is the row field: Rep.

### Displaying a Change from a Previous Field

Figure 3.34 shows the % Difference From setting. This calculation requires a base field and base item. You could show how each market compares to Anne Troy by specifying Anne Troy as the base item. This would be similar to Figure 3.31, except each market would be shown as a percentage of Anne Troy. Figure 3.34 The % Difference From options enable you to compare each row to the previous or next row.

With date fields, it would make sense to use % Difference From and choose (previous) as the base item. Note that the first cell will not have a calculation because there is no previous data in the pivot table.

### Tracking the Percentage of a Parent Item

The legacy % of Total settings always divides the current item by the grand total. In Figure 3.35, cell E4 says that Chicago is 2.75% of the total data set. A common question at the MrExcel.com message board is how to calculate Chicago’s revenue as a percentage of the Midwest region total. This was possible but difficult in older versions of Excel. Starting in Excel 2010, though, Excel added the % of Parent Row, % of Parent Column, and % of Parent Total options. Figure 3.35 An option in Excel enables you to calculate a percentage of the parent row.

To set up this calculation in Excel 2016, use Field Settings, Show Values As, % of Parent Row Total. Cell D4 in Figure 3.35 shows that Chicago’s \$184,425 is 10.59% of the Midwest total of \$1,741,424.

Although it makes sense, the calculation on the subtotal rows might seem confusing. D4:D8 shows the percentage of each market as compared to the Midwest total. The values in D9, D11, D16, and D19 compare the region total to the grand total. For example, the 31.67% in D11 says that the Northeast region’s \$2.1 million is a little less than a third of the \$6.7 million grand total.

### Tracking Relative Importance with the Index Option

The final option, Index, creates a somewhat obscure calculation. Microsoft claims that this calculation describes the relative importance of a cell within a column. In Figure 3.36, Georgia peaches have an index of 2.55, and California peaches have an index of 0.50. This shows that if the peach crop is wiped out next year, it will be more devastating to Georgia fruit production than to California fruit production. Figure 3.36 Using the Index function, Excel shows that peach sales are more important in Georgia than in California.

Here is the exact calculation: First, divide Georgia peaches by the Georgia total. This is 180/210, or 0.857. Next, divide total peach production (285) by total fruit production (847). This shows that peaches have an importance ratio of 0.336. Now, divide the first ratio by the second ratio: 0.857/0.336.

In Ohio, apples have an index of 4.91, so an apple blight would be bad for the Ohio fruit industry.

I have to admit that, even after writing about this calculation for 10 years, there are parts that I don’t quite comprehend. What if a state like Hawaii relied on productions of lychees, but lychees were nearly immaterial to U.S. fruit production? If lychees were half of Hawaii’s fruit production but 0.001 of U.S. fruit production, the Index calculation would skyrocket to 500.