Right-click any cell in the column you want to sort by, such as a value in Grand Total, and choose Sort → Sort Largest to Smallest or Sort Smallest to Largest. The rows reorder by that column. Home → Sort & Filter does the same with the cell selected.
To sort the labels alphabetically, click the drop-down arrow on the Row Labels or Column Labels header and choose Sort A to Z or Sort Z to A. With more than one field in rows, pick the field from Select field at the top of that menu first.
To sort the columns by one row’s values, select a value in that row, go to Home → Sort & Filter → Custom Sort, choose Largest to Smallest and set Sort direction to Left to Right.
For an order that is neither alphabetical nor numerical, click a label cell, hover over its border until the pointer turns into a four-headed arrow, and drag it to its new place. Months and weekdays sort in calendar order through Excel’s custom lists; if yours sort alphabetically, tick PivotTable Options → Totals & Filters → Use Custom Lists when sorting.
With two row fields, sorting reorders the inner items within each outer group, not across the whole table. To keep a sort as the data changes, open Sort → More Sort Options → More Options and tick Sort automatically every time the report is updated.
Sorting a pivot table in Excel can help organize and analyze large amounts of data.
By sorting the data in a particular order, you can quickly identify trends, patterns, and outliers that may be difficult to spot otherwise. Additionally, sorting a pivot table makes your report dynamic. The user can interact with the reports.
Steps to Sort Pivot Tables Data (Based on Values)
Let’s sort a basic pivot table. Here, we want to sort the grand total column from largest to smallest (descending sorting) to find the best-selling product.

- First of all, select any cell in the Grand Total column and go to the Home tab.

- Further, click on Sort & Filter under Editing.

- After clicking on the Sort & Filter option, a drop-down list will appear.

- Here you will find the required option, “Sort Largest to Smallest”. Just a click away to sort your data.

- Finally, the data is sorted.

Similarly, you can sort the data from the grand total row.
- To start with, again click on any cell in the total row.

- Now, go to Home → Sort & Filter.

- From here, click on Sort Largest to Smallest.

- The total row is sorted from largest to smallest.

In the above Pivot table, the grand total column and row are sorted from largest to smallest value. However, you can use the same steps to sort the total row or column in ascending order (Sort Smallest to Largest).
Excel also provides an alternative way to sort data in Pivot Tables. Instead of using the ‘Sort & Filter’ button, you can right-click on a cell in the column you want to sort and use the Sort option from the menu.
Sorting Data in Pivot Table Custom Sort
Imagine you must sort the months for the product Cake from “Largest to Smallest” or vice versa. You can do this using a custom sort option.
- Click on any value in the row Cake, excluding the Grand Total, as we are not sorting the grand totals.

- Now click on Home → Editing → Sort & Filter.

- After you click on the drop-down arrow, click on Custom Sort.

- Here you will get the “Sort By Value” window.

- Now select Largest to Smallest under Sort options.

- Similarly, select the sort direction. Here we want to sort the columns from left to right, so we will select Left to Right.

- Here we go. Now you can easily find out which month had the highest and the lowest sale.

What if you need to make a minor change other than the selected pattern in your pivot?
For example, you have sales data from January to December. Let’s assume you need to bring the current month, say August, to the top. This does not fit into any set pattern.
Don’t worry, this is possible. In such cases, you can sort the pivot table manually. Here’s a simple example.

In the above table, the data is organized from Jan to Dec in the Columns, and the Countries are sorted in alphabetical order. Follow the steps below to bring “Aug” to the first column and “India” to the top row.
- First of all, select the header of the column you want to move. Here we want to move the month of Aug. So, we will select the cell Aug.

- Remember we only need to select the header cell.
- Now, once you move your cursor on the border of the selected cell, a move object cursor will appear.

- After this, click and hold the mouse button and drag the column to the position where you want to move. Here we will drag it to the first column.

- Similarly, repeat the steps with the country.
- Select “India” and move the cursor on the border to get the move cursor and simply drag it to the first position.

Sorting Pivot Tables in Alphabetical Order
Now, let us sort the countries back into alphabetical order for the convenience of our audience. We can do this in two different ways.

- To begin with, click on the top cell “India” in this example.

- Now click on the Home tab and go to the Sort & Filter button.

- Here click on the option “Sort A To Z”.

- The data is sorted. Now you see the countries are sorted in alphabetical order from A to Z.

You can also use the following steps to use another way of sorting in alphabetical order.
- Select the Header cell i.e., “Country” in the pivot table.

- Now click on the small drop-down arrow next to “Country”.

- Now click on the first option i.e., “Sort A to Z”.

- Here we go. The countries are sorted in alphabetical order from A to Z.

Manual Dragging to Sort a Pivot Table
Manual dragging is another method to sort data in a pivot table. This method offers a high degree of customization, allowing you to manually rearrange rows or columns to fit your specific needs.
To manually drag and sort data in a pivot table, click on the row or column header you wish to move. While holding the left mouse button, drag the header to the desired location in the pivot table.
Once you release the mouse button, the row or column will relocate to the chosen position. This method is proper when the desired order of data does not follow a standard ascending or descending pattern.
Note – If conditional formatting is applied on a pivot table, unfortunately, Excel won’t allow you to sort data based on the conditional formatting colors, icon sets, or data bars.
More Sort Options
In some specific situations, you can use More Sort Options, which gives you a few more options for sorting data.

There are two types of “More Sort Options”. When you select a value field and then open the more sort options, it shows you a dialog box like the following:

When you choose the Left to Right option in this dialog box, Excel sorts the columns based on the values in the selected row.
When you select a cell from the row label and the column label and open the more sort options, Excel shows a different dialog box, like the following:

When you click on the “More Options” button, this dialog box shows you a new dialog box where you can tick mark “Sort automatically every time the report is updated”. This keeps the data sorted automatically when you refresh the pivot table with new data.
Sort Months and Days in the Right Order
When you sort month or day names A to Z, Excel uses its built-in custom lists, so Jan, Feb, Mar… stay in calendar order instead of alphabetical order. This works because the “Use Custom Lists when sorting” option is on by default (right-click the pivot table ➜ PivotTable Options ➜ Totals & Filters).
You can also create your own order, like a list of regions or sizes (Small, Medium, Large). Go to File ➜ Options ➜ Advanced ➜ Edit Custom Lists, add your list, then refresh the pivot table and sort it A to Z.
Why Is My Pivot Table Not Sorting?
- You dragged items manually: after a manual drag, the field uses manual sorting. Use Sort A to Z (or Largest to Smallest) again to go back to automatic sorting.
- The sort isn’t kept after a refresh: open More Sort Options ➜ More Options and tick “Sort automatically every time the report is updated”.
- Numbers are sorted like text: if the row labels are numbers stored as text, 10 comes before 2. Convert them to numbers in the source data and refresh.
Frequently Asked Questions
Can I sort a pivot table by two columns?
Not like a normal range. Each row field is sorted on its own, so when you have two row fields, you can sort the outer field one way and the inner field another way, and the inner items are sorted within each outer item.
How do I sort a pivot table by the grand total?
Select any cell in the Grand Total column (not the grand total cell at the bottom) and use Sort Largest to Smallest, as shown in the first steps above.
Can I sort by color in a pivot table?
No. Sort by color isn’t available in pivot tables. Sort by the values that the colors are based on instead.
More on Pivot Table
Refresh a Pivot Table | Pivot Table Keyboard Shortcuts | Delete a Pivot Table | Pivot Table Formatting |Move a Pivot Table | Filter a Pivot Table | Count Unique Values in a Pivot Table | Change Pivot Table Data Source| Add or Remove Grand Total in a Pivot Table | Add Ranks in Pivot Table | Insert Calculation in Pivot Table | Refresh All Pivot Tables | Automatically Update a Pivot Table | Running Total in a Pivot Table | Conditional Formatting to a Pivot Table | Pivot Table from Multiple Worksheets | Group Dates in a Pivot Table | Connect a Slicer with Multiple Pivot Tables | Pivot Table Timeline