Sort data in a PivotTable report or a PivotChart report
Sorting data is an integral part of data analysis. You might want to put a list of names in alphabetical order or compile a list of product inventory levels from highest to lowest. Sorting data enables you to quickly visualize and understand your data better, organize and find the data that you want, and ultimately make more effective decisions.
Note To find the top or bottom values in a set of data, such as top 10 grades or bottom 5 sales amounts, use the Top 10 Filter dialog box or conditional formatting. For more information, see Filter data in a PivotTable or PivotChart report and Add, change, or clear conditional formats.
What do you want to do?
Sort data in column or row labels
Learn more about sorting
You can sort data by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest). When sorting text, in some cases, data might have leading spaces inserted before data. For best results, remove the leading spaces before you sort text data. Unlike sorting a cell range or Excel table, you cannot do a case-sensitive sort of text, or sort by format, whether by cell color, font color, or icon set.
Sort orders vary by locale setting. Make sure that you have the proper locale setting in Regional Settings or Regional and Language Options in Control Panel on your computer. For information about changing the locale setting, see the Windows Help system.
Note In a field that is organized in levels, you can sort all of the items for a lower level together by collapsing the upper levels before you sort. For more information, see Expand or collapse details in a PivotTable or PivotChart report.
Sort data in column or row labels
- Select a column or row field in a PivotTable report or PivotChart report.
In a PivotTable report, click a column or row label.
In a PivotChart report, click the field in the associated PivotTable report . To sort items in a series field, click the corresponding column label. To sort items in a category field, click the corresponding row label.
- On the
Optionstab, in theSortgroup, do one of the following:Text
- To sort in ascending alphanumeric order, click
Sort A to Z. - To sort in descending alphanumeric order, click
Sort Z to A.
Numbers
- To sort in ascending alphanumeric order, click
Sort Smallest to Largest. - To sort in descending alphanumeric order, click
Sort Largest to Smallest.
Dates and times
- To sort in ascending alphanumeric order, click
Sort Oldest to Newest. - To sort in descending alphanumeric order, click
Sort Newest to Oldest.
- To sort in ascending alphanumeric order, click
- Optionally, to customize the sort operation, on the
Optionstab, in theSortgroup, clickSort.In the
Sort <Field name>dialog box, select the type of sort that you want by doing one of the following:- To return items to their original order, click
Data source order. This option is only available for OLAP source data. - To drag and arrange items the way that you want, click
Manual. - To select a field to sort by in ascending sort order, select
Ascending (A to Z), and then select the field from the drop-down list. - To select a field to sort by in descending sort order, select
Descending (A to Z), and then select the field from the drop-down list.
Tip Read the
Summarysection at the bottom of the dialog box to verify your choices. - To return items to their original order, click
- Optionally, to continue customizing the sort operation, click
More Options.In the
More Sort Optionsdialog box, do one or more of the following:- To enable or disable the sort operation each time that the PivotTable report is updated, under the
AutoSortsection, select or clear theSort automatically every time the report is updatedcheck box. - To sort in a user-defined sort order by using a custom list, under the
First key sort ordersection, select the custom list from the drop-down list. This option is only available if you have not selected the check box under theAutoSortsection.Microsoft Office Excel provides built-in, day-of-the-week, and month-of-the year custom lists, and you can also create your own custom list. For more information, see Sort data in a range or table.
Notes:
- To enable or disable custom lists, set or clear the
Use Custom Lists when sortingcheck box on theFilters & Totalstab in thePivotTable Optionsdialog box. Clearing this check box may also improve performance when you sort large amounts of data. For more information, see PivotTable options. - The custom list sort order is not retained if you refresh the report.
- To enable or disable custom lists, set or clear the
- To change the type of sort, do one of the following:
- To sort by grand total values, click
Grand Total. - To change the row or column, select
Values in selected roworValues in selected column, and then enter a reference to a cell in the row or column with the values to sort by in the box.Alternatively, to select a row or column, click
Collapse Dialog
to temporarily hide the dialog box, select the row or column, and then press Expand Dialog
.
- To sort by grand total values, click
-
Tip Read the
Summarysection at the bottom of the dialog box to verify your choices.
- To enable or disable the sort operation each time that the PivotTable report is updated, under the
Sort data in the values area
- Select a value field in a PivotTable report.
- On the
Optionstab, in theSortgroup, do one of the following:- To sort in ascending alphanumeric order, click
Sort Smallest to Largest. - To sort in descending alphanumeric order, click
Sort Largest to Smallest.
- To sort in ascending alphanumeric order, click
- Optionally, to customize the sort operation, on the
Optionstab, in theSortgroup, clickSort.In the
Sort By Valuedialog box, do one or more of the following:- Under
Sort options, do one of the following:- To sort numbers in ascending sort order, select
Smallest to Largest. - To sort numbers in descending sort order, select
Largest to Smallest.
- To sort numbers in ascending sort order, select
- Under
Sort direction, do one of the following:- To sort values vertically, select
Top to bottom. - To sort values horizontally, select
Left to right.
- To sort values vertically, select
-
Tip Read the
Summarysection at the bottom of the dialog box to verify your choices.
- Under