Pivot Table Tutorial Part 5 - How to Sort a Pivot Table in Excel


Sort a Pivot Table in Excel

Excel Pivot Table Before Sorting

You can sort a Pivot Table in Excel horizontally or vertically. This allows you to see, at a glance, the rows or columns containing the greatest or the smallest values.

We will illustrate how to sort the values in a Pivot Table, using the above example pivot table on the right, which shows a company's monthly sales, broken down by sales representative.

In order to sort a column or row of the Pivot Table, we use the Excel Sort Ascending and Sort Descending commands which are represented by the following symbols in the Excel menu:

Sort Buttons AZ Ascending and ZA Descending

These commands are found:

In Current Versions of Excel:Within the 'Sort & Filter' group of the 'Data' tab of the ribbon or
By right-clicking on the Pivot Table and selecting the 'Sort' option
In Excel 2003:In the 'Standard' toolbar or
in the 'Data' menu, within the 'Sort...' option

Sort a Pivot Table by a Column

Imagine you want to easily see which months recorded the highest total sales values.

Excel Pivot Table Sorted by Grand Total Column

By sorting the 'Grand Total' column of the pivot table, in descending order, the month with the greatest total sales figures is positioned at the top of the table, followed by the second greatest sales figure, etc.

To sort the pivot table by the values in the 'Grand Total' column:

  1. Click on any value inside the 'Grand Total' column;
  2. Select the 'Sort Descending' command.

The resulting sorted Pivot Table is shown on the rightabove. This enables you to easily see that the month with the highest sales was June, followed by January.



Sort a Pivot Table by a Row

Imagine you want to order the yearly sales totals, so that the person with the greatest total yearly sales is listed first.

Excel Pivot Table Sorted by Grand Total Row

To do this:

  1. Click on any value inside the 'Grand Total' row (i.e. cell B17 or C17 of the example spreadsheet);
  2. Select the 'Sort Descending' command.

The resulting sorted Pivot Table is shown on the rightabove. As required, the individuals have been ordered, so that the highest total sales (Smith - Total Sales: $345,908) appears first.

Note that you could also sort the table alphabetically, according to the sales peoples' names. This is done by clicking on one of the names (either cell B4 or C4) and sorting either in ascending or descending order.