# Customizing an Excel 2013 Pivot Table

• 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. Whereas the options under 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 offer interesting options such as % of Total, Running Total, and Ranks.

For Excel 2010 only, these options appeared as two drop-down menus in the ribbon. They were removed from the 2013 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. These include % of Parent Item, Rank, and % Running Total In.

The following examples show how to use the various calculation options. To contrast the various settings, you can build a pivot table where you drag the Revenue field to the VALUES area nine separate times. Each shows up as a new column in the pivot table. Over the course of the rest of the chapter, you 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. Choosing one of these 11 calculation options changes 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. Counting distinct items has been difficult in pivot tables, but now is possible using PowerPivot. See Chapter 10 for more details.

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 row’s percentage of the parent item’s total row. % of Parent Column Total None With multiple column fields, shows a column’s 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 percent 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 percent 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

Column E of Figure 3.29 shows the % of Total. New York 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, the current data set shows that New York is the largest market. Perhaps this company started in New York and has the largest concentration of customers in New York. Perhaps the home office is in New York. The people in New York might have a New York–centric view of the world and want to show how all of the other markets are doing as a percentage of New York. Cell E6 of Figure 3.31 shows that Atlanta is about 25% the size of New York in sales.

To set up this calculation, choose Show Values As, % Of. For the Base Field, choose Market because this is the only field in the ROWS area. For the Base Item, choose New York. The result is shown in Figure 3.31.

### Showing Rank

Two ranking options were added in Excel 2010. Column G of Figure 3.32 shows Rank Largest to Smallest. New York is ranked #1, Minneapolis 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 a Base Field. In this example, because Market is the only row field, it is the Base Field.

These rank options in Excel 2013 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 Percent of Running Total

Running total calculations is 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 markets 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: Market.

### Display 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 New York by specifying New York as the base item. This would be similar to Figure 3.31, except each market would be shown as a percentage of New York.

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

### Tracking Percent of Parent Item

The legacy % of Total settings always divide 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 before Excel 2010. Starting in Excel 2010, Excel added the % of Parent Row, % of Parent Column, and % of Parent Total.

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

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 are comparing the region total to the grand total. For example, the 31.67% in D11 is saying that the Northeast region’s \$2.1 million is a little less than a third of the \$6.7 million grand total.

### Track 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. If the peach crop is wiped out next year, it will be more devastating to Georgia fruit production than to California fruit production.

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

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

However, 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 fruit production, but 0.001 of U.S. fruit production, the Index calculation would skyrocket to 500.