To sort a pivot table by its Grand Total column or row in Excel, right-click any cell inside the Grand Total column (or row), hover over Sort, and choose Sort Largest to Smallest or Sort Smallest to Largest. This reorders the row labels (or column labels) based on the values in the Grand Total, giving you an instant ranking of categories by their overall totals.
Why Sorting by Grand Total Is Different from Regular Sorting
In a normal data range, sorting is straightforward: you select a column and click A→Z or Z→A. In a pivot table, the row labels are not independent cells—they are tied to the underlying data and the pivot’s internal layout. When you sort a pivot table by a field value (like a specific month or product), Excel only reorders that one column’s context. Sorting by the Grand Total, however, uses the aggregate of all columns (or rows) as the sort key. This is especially useful when you have multiple value fields (e.g., Sales, Profit, Units) and you want to see which product performs best overall, not just in one measure.
Excel’s default sort for a pivot table is usually by the first field’s alphabetical order or by the order data was entered. Sorting by Grand Total overrides that default and creates a dynamic ranking that updates if you refresh the pivot or change filters.
Step-by-Step: Sort by Grand Total (Row Labels)
Here’s how to sort the row labels by the Grand Total column (the far-right column that sums all values for each row).
- Click anywhere inside the pivot table to activate the PivotTable Analyze tab (or PivotTable Tools on Mac).
- Locate the Grand Total column—it’s usually the last column on the right, labeled “Grand Total.”
- Right-click any cell within that Grand Total column (for example, the cell that shows the total for the first row label).
- Hover over Sort in the context menu.
- Choose Sort Largest to Smallest to put the highest total at the top, or Sort Smallest to Largest for the reverse.
The row labels will instantly reorder. On a Mac, the right-click menu is the same; if you use a trackpad, Control+click works.
Sorting by Grand Total Row (Column Labels)
If your pivot table has multiple columns (e.g., months across the top) and you want to sort the column labels by the Grand Total row (the bottom row that sums each column), the process is mirrored:
- Find the Grand Total row at the bottom of the pivot table.
- Right-click any cell in that row (like the cell under the first month).
- Hover over Sort and select either Sort Largest to Smallest or Sort Smallest to Largest.
This reorders the months (or other column labels) by their total across all rows. This is handy when you want to see which month had the highest overall sales, regardless of product.
Using the Sort Dialog for More Control
The right-click method is quick, but you might want more control—for example, sorting by a specific value field’s Grand Total rather than the overall total. Use the Sort dialog:
- Right-click a cell in the row labels area (not the Grand Total column).
- Choose Sort > More Sort Options….
- In the dialog, select Descending (Z to A) by: or Ascending (A to Z) by:.
- From the dropdown, choose the field that represents your Grand Total—usually it’s named like “Sum of Sales” or “Grand Total” depending on your layout.
- If you have multiple value fields, you can pick which one to sort by (e.g., sort by Profit’s total, not Sales).
- Click OK.
This method lets you sort by a specific value’s Grand Total even if you have several value fields stacked in the Values area. Note: The Sort dialog also allows you to sort manually by dragging labels, but that’s not the same as sorting by totals.
Common Problems and Fixes When Sorting by Grand Total
Sometimes the right-click sort option is grayed out or doesn’t work as expected. Here are the usual culprits:
- You right-clicked the wrong cell. You must right-click a cell that is part of the Grand Total row/column, not a regular data cell. If you right-click a normal value cell, the Sort menu only offers sorting by that specific column’s values, not the total.
- Your pivot table has a filter applied. If a row or column filter is active, sorting by Grand Total still works, but the totals only reflect the visible filtered data. Clear filters if you want the true overall ranking.
- You have multiple value fields and the Grand Total is the sum of all of them. If you have Sales and Profit as separate value fields, the Grand Total column shows the sum of both—which is meaningless (adding dollars of sales to dollars of profit). In that case, sort by a specific field’s subtotal using the Sort dialog, not the overall Grand Total.
- Your pivot table is in Compact Layout. In Compact Layout, row labels are in a single column, and the Grand Total column still appears. The right-click method works, but the Sort dialog may show different field names. Switch to Tabular or Outline layout if you prefer a clearer view.
- You have a calculated field or item. Calculated fields can affect sorting because they add extra rows/columns. Sorting by Grand Total will include those calculations, which may not be what you expect.
Sorting When You Have a Pivot Chart
If you’ve created a pivot chart from your pivot table, sorting the table by Grand Total will automatically reorder the chart’s categories. This is a great way to make a bar chart show the largest category first without manually reordering the data. However, if you have a separate chart (not a pivot chart), it won’t update—you’d need to sort the underlying data or use a dynamic array formula like =SORT() to reorder the chart’s source range.
Alternatives: Using Excel Formulas to Sort Totals
If you prefer not to use pivot table sorting (or you want a static snapshot), you can use the SORT function (available in Excel 2021 and Microsoft 365) to reorder a summary table. For example, assume you have product names in A2:A10 and their total sales in B2:B10 (calculated with SUMIF or from a pivot table). To sort by total descending:
With names in A2:A10 and totals in B2:B10, enter in D2:
=SORT(A2:B10, 2, -1)
This returns a two-column array sorted by the second column (totals) in descending order (-1). The result spills into D2:E10 automatically. This is a dynamic alternative that updates if the source values change, but it doesn’t require a pivot table. Note: SORT is not available in Excel 2019 or earlier; you’d need to use the legacy LARGE or manual sorting.
Frequently Asked Questions
Why is the Sort option grayed out when I right-click the Grand Total?
This usually happens because you’re right-clicking a cell that isn’t actually part of the Grand Total—for example, a subtotal row or a cell that’s part of a different field. Make sure you’re clicking a cell that shows the total for a row/column, not a label. Also, if the pivot table is in a protected sheet, sorting may be disabled.
Can I sort by Grand Total in Excel for the web?
Yes, the right-click sort option works in Excel for the web, but the Sort dialog is more limited. On the web, right-click a Grand Total cell, hover over Sort, and choose Largest to Smallest or Smallest to Largest. The More Sort Options dialog is not available in the browser version, so you can’t sort by a specific value field’s total—only the overall Grand Total.
Does sorting by Grand Total affect my original data?
No, pivot table sorting only changes the display order of the pivot table. Your source data remains untouched. If you refresh the pivot, the sort order is preserved unless you change the sort settings.
How do I sort by Grand Total but keep a specific item at the top?
You can’t do that directly with the Grand Total sort. Instead, use a custom sort order: right-click a row label, choose Sort > More Sort Options, and then under Manual, you can drag items to the desired position. However, that manual order will not automatically re-sort by totals—it’s a fixed order. A workaround is to add a helper column that ranks items, but that’s more complex.
What if my Grand Total column shows text or blanks?
If your Grand Total contains blanks or text, sorting by it may not work as expected. Ensure that all value fields are numeric and that there are no #N/A errors. If you have a calculated field that returns text, remove it or convert it to a number.
Can I sort by Grand Total when I have row labels in multiple columns?
Yes, but the sort applies to the entire row label hierarchy. For example, if you have Region and Product as row labels, sorting by Grand Total will reorder the outer label (Region) based on the total of all its products, but the inner labels (Products) within each region are not separately sorted by their own totals unless you sort them individually.
Related
- Power automate format string?
- Random Number 1-8: How to Generate One
- Cut Shortcut on Mac: The Fastest Ways
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Excel Power Pivot Tab: Where It Is and How to Enable ItThe Power Pivot tab is an optional Excel ribbon tab for working with data models, relationships, and DAX…
- Excel Pie Chart Not Working? Fix Common Data IssuesIf an Excel pie chart is blank, incomplete, or showing the wrong slices, first check that its source…
- Excel Line Chart: How to Ignore Zero Values in a ChartYes. To make an Excel line chart ignore numeric zeros, create a helper column that returns NA() for…
- Excel Column Chart Too Narrow? How to Make Bars WiderIf the columns in an Excel chart look too narrow, select a column in the chart, open Format…
- Balloon Chart in Excel: A Step-by-Step TutorialTo make a balloon chart in Excel for Microsoft 365 on Windows, arrange your data in columns for…
- Excel Mac Pivot Tables: Create, Refresh, and TroubleshootYes—Excel for Mac can create and use PivotTables. Select a clean data range, choose Insert > PivotTable, then…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.