To sort a pivot table in Google Sheets, click inside it and use the Pivot table editor: under Rows or Columns, choose a field in Sort by, then select Ascending or Descending under Order. To rank groups by a calculation such as total sales, choose that summarized value field in Sort by instead of the label field.
What sorting a pivot table changes
A pivot table groups and summarizes source data, so its sort controls arrange the groups in the result rather than simply sorting the original rows. For example, a sales pivot table can show one row per product and a total for each product. Sorting by Product arranges the names alphabetically or in reverse alphabetical order; sorting by SUM of Sales ranks the product groups by their totals.
This distinction matters because the order of records in the source sheet is not a dependable way to control the order of pivot table results. The pivot table follows its own field settings. Changing the sort there leaves the underlying records in place and changes how the summarized groups are displayed.
Sorting also does not filter out groups or change the calculation. It only changes their order. If the goal is to show only the highest-selling products, sorting can put the leaders at the top, but you may also need a filter to limit which groups appear.
Create or open the pivot table
If you already have a pivot table, click any cell inside it to open its Pivot table editor. If you are starting from scratch, first check that the source data has a header in each column and that each row represents one record. For instance, a sales list might have columns named Date, Product, Region, and Sales.
- Select a cell in the source data, or select the complete data range, including its headers.
- Choose Insert > Pivot table.
- In the dialog, confirm the data range and choose New sheet or Existing sheet, then create the pivot table.
- In the Pivot table editor, click Add beside Rows to choose a grouping field, and Add beside Values to choose a field to summarize.
For a product sales example, add Product under Rows and Sales under Values. The Values area usually summarizes numeric fields, such as by SUM, but you can change the summary method in the editor. Once the pivot has groups to arrange, its row or column settings provide the sorting controls.
Sort row labels alphabetically or numerically
To sort the groups by their own labels, find the relevant field under Rows in the Pivot table editor. Open the Sort by dropdown and choose that row field. Then use Order to select Ascending or Descending. A text field sorts by its label, while numeric and date fields are arranged according to their values or dates.
For example, if Product is in Rows and the products are Apple, Pear, and Plum, ascending label order places them alphabetically. Descending reverses that order. If Month is represented by actual date values, ascending order places earlier dates first. If months are stored as plain text, they may sort alphabetically rather than in calendar order; use real dates or a suitable month-number field when calendar sequence matters.
When a pivot table has more than one row field, choose the field whose group labels you want to arrange. A report grouped first by Region and then by Product has separate levels. Sorting the Region field orders the top-level regions; sorting Product orders products within the relevant region groups. It does not flatten the hierarchy into one ordinary list.
Sort groups by a summarized value
To rank groups using their totals or another calculation, select the row field under Rows and open Sort by. Choose the relevant value field, which may appear with its summary name, such as SUM of Sales. Set Order to Descending to put the largest result first, or Ascending to put the smallest first. The labels remain the group names; the value determines their ranking.
Suppose a pivot table lists Product in Rows and SUM of Sales in Values. If Pear totals 840, Apple totals 610, and Plum totals 390, sorting Product by SUM of Sales in descending order displays Pear, Apple, then Plum. The amounts are the same as before; only the order of the product groups changes. If you choose ascending order, Plum appears first.
When there are multiple value fields, make sure you choose the intended measure. A pivot with SUM of Sales and AVERAGE of Sales can produce different rankings depending on which one is selected. Likewise, sorting by a count answers a different question from sorting by a sum. Check the calculation shown in the Values section before interpreting the ranking.
If the summarized-value field does not appear as an option, check that the value has been added to Values and that the pivot table contains a usable summary for it. A text field, for example, may be counted rather than summed. Choose an appropriate summary method for the kind of data and the question you are trying to answer.
Sort pivot table columns
Pivot tables can also group data across Columns. To change the order of those column groups, use the field under Columns in the editor and adjust its Sort by and Order settings. This is useful when a report places regions, quarters, or categories across the top and you want those headings in a deliberate order.
Column sorting can be less intuitive when the table contains several row and value fields because the layout represents intersections of groups. Confirm which field is listed under Columns before changing its sort settings. If the objective is to reorder product or customer names down the left side, adjust the corresponding field under Rows, not the field under Columns.
Pivot-table sorting versus sorting source data
Sorting the source range with the toolbar or a sheet sort command changes the order of records in that range. It does not set the pivot table’s group order. The pivot table has separate sorting settings, so use its editor when the goal is to rank or alphabetize the summarized results.
The source data still matters. Pivot tables summarize the records in their source range, and changes to included records can affect their results. If new records are added outside the range used by the pivot table, they may not be included until you update the source range in the pivot table editor. Sorting the source range cannot fix an incomplete range; check the range itself when expected records are missing.
Similarly, sorting a pivot table is not the same as applying a filter. A filter restricts which source values or groups are included, while sorting changes their display order. To show only selected regions and rank them by revenue, use the relevant pivot filter and then set the sort order for the row groups.
Common sorting problems and fixes
- The groups are still in an unexpected order: Check the field selected in Sort by and confirm whether it is a label or a summarized measure. Also check Ascending or Descending; the setting may be correct but point in the opposite direction from what you expect.
- Months do not appear in calendar order: If month names are text, alphabetical order is expected. Use date values or add a numeric month field to the source data, then sort by that field where appropriate.
- The totals look right but the ranking is wrong: Check which value field and summary method control sorting. Sorting by average, count, or sum can produce different results.
- New records are absent: Inspect the source range in the Pivot table editor. The range may stop before the newer rows.
- A nested report is only partly reordered: Check the sort setting for each row field. A multi-level pivot table has separate grouping levels, so sorting one level does not necessarily reorder every level in the way a flat table sort would.
After changing a setting, look at the pivot table itself and confirm that both the labels and the associated totals still match the question you intended to answer. If the layout is complex, test the setting on a simple copy of the pivot table before changing a report that others rely on.
Choosing a useful sort for your report
Choose the sort key based on what a reader needs to find. Alphabetical order is useful for lookup and scanning; chronological order suits timelines; sorting by a total or average helps reveal the largest or smallest groups. A clearly named value field and an appropriate summary make ranked reports easier to understand.
For a sales report, a practical setup might place Region and Product under Rows, Sales under Values, and sort Product by SUM of Sales descending. If you need to compare products separately within each region, inspect the nested groups to ensure the ranking is being applied at the intended level. If your goal is simply to find the overall top products, a simpler pivot with Product as the row field may make the result easier to interpret.
Google Sheets is used here in a web browser. Excel also supports sorting PivotTables, but its interface and field controls differ; do not assume that a Google Sheets menu path or editor option has the same name or location in Excel.
Frequently Asked Questions
Can I sort a Google Sheets pivot table by total?
Yes. In the Pivot table editor, use the relevant field under Rows, choose the summarized measure, such as SUM of Sales, in Sort by, and set the order. The measure must be present under Values.
How do I sort a pivot table from largest to smallest?
Choose the summarized value field as the sort key and set Order to Descending. This places the groups with the largest selected result first.
Can I sort pivot table labels A to Z?
Yes. Choose the row-label field itself in Sort by and choose Ascending. For text labels, ascending generally means alphabetical order; for numeric or date fields, it follows their underlying values.
Why are months sorted alphabetically in my pivot table?
The month field is likely stored as text, such as January or February, rather than as dates. Text labels sort alphabetically. Use real date values or a numeric month field if you need calendar order.
Does sorting the source sheet sort the pivot table too?
Not reliably. Source sorting rearranges records, while the pivot table uses its own Sort by and Order settings. Set the order in the Pivot table editor to control the summarized groups.
Related
- Insert a Square Checkbox in Word: Symbol or Clickable Box
- Insert a Personal Signature in Word for Mac: Steps & Tips
- Insert a Personal Signature in Word Online: Steps and Tips
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Quadrant Chart in Google Sheets: How to Build OneGoogle Sheets does not have a dedicated quadrant-chart type, but you can make one with a scatter chart…
- Excel Pie Chart from a Table: Create and Format ItTo make an Excel pie chart from a table, select the category names and their numeric values, then…
- Excel Box and Whisker Plot X-Axis ExplainedIn an Excel box-and-whisker plot, the x-axis is the horizontal category axis: it identifies the groups represented by…
- Excel Chart Title From Cell: Link, Format, and FixesTo link an Excel chart title to a cell, select the chart title, click the formula bar, type…
- Excel Chart Data Labels in Millions: Number FormatTo show Excel chart data labels in millions, select the labels, open Format Data Labels, then under Number…
- How to Put an Excel Chart in PowerPointTo put an Excel chart in PowerPoint, select the chart in Excel, press Ctrl+C, switch to PowerPoint, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.