Microsoft Excel PivotTables are a great way to summarize data. Theyâ€™re easy to create and display information in meaningful ways, such as subtotals and grand totals that return sums, counts and averages. By default, Excel displays a SUM() function for subtotals and grand totals, but you might run into situations where you need more than one subtotal and grand total.

In this tutorial, Iâ€™ll show you how to display multiple subtotals in a PivotTable. The method isnâ€™t intuitive, so itâ€™s possible that you might not even know you can do this.

SEE: 108 Excel tips every user should master (TechRepublic)

Iâ€™m using Microsoft 365 on a Windows 10 64-bit system, but you can use older versions of Excel. Excel for the web supports PivotTables.

## How to create a PivotTable in Excel

Now letâ€™s suppose you track sales for several cities across the US and you want to see subtotals for the five regions. Figure A shows the source data and the first PivotTable you might design.

Figure A

To create this PivotTable, click anywhere inside the data source Excel Table and then do the following:

1. Click Insert.
2. Inside the Tables group, click PivotTable.
3. In the resulting dialog, click Existing Worksheet, and then click G2 in the Location control.
4. Excel will insert a blank frame. Using Figure A as a guide, build this PivotTable by dragging fields to the appropriate sections.

Before we continue, letâ€™s change the structure a bit to make the PivotTable a little more readable:

1. Click inside the PivotTable and click the contextual Design tab.
2. In the Layout group, choose Show All Subtotals At The Bottom Of The Group from the Subtotals dropdown.
3. From the Report Layout dropdown choose Show In Tabular Form.
4. From the Report Layout dropdown, choose Do Not Repeat Item Labels.

The resulting PivotTable, shown in Figure B, is more readable than the default structure. Doing so isnâ€™t necessary, but I believe this format is a bit cleaner and easier to read.

Figure B

As is, the PivotTable displays subtotals for each region and a grand total. What if you want to see the average sale for each region? In this case, youâ€™ll need a second subtotal row.

## How to add a second subtotal row to a PivotTable in Excel

The default PivotTable is useful, but you might need more information. For instance, letâ€™s add a second subtotal row that returns the average sale for each region. You could add Amount to the Values list in the Fields pane and then set it to average instead of sum, but doing so will add another column of the same values. Frankly, the results would be busy and distract viewers.

Instead, do the following:

1. Click any cell in the Region column in the PivotTable.
2. Click the contextual PivotTable Analyze tab.
3. In the Active Field group, click Field Settings.
4. In the resulting, click Custom in the Subtotals section.
5. From the function list, choose Sum and Average (Figure C).
6. Click OK.

Figure C

Figure D

You just added an average row to the PivotTable, as shown in Figure D. This process isnâ€™t particularly intuitive, and itâ€™s compounded by the requirement that you select Sum and Average. With the sum subtotal row already in place, you might select only Average, which would replace the sum row instead of inserting an additional row of averages.

## Stay tuned

Excel PivotTables are flexible. The one thing thatâ€™s not available is a way to add more grand total rows. In a future article, Iâ€™ll show you how to do so.

### Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

### Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays