Sub topic 7
Sorting Results and Controlling Totals
Assume you can create a pivot table and use the Pivot table editor. You should also understand basic aggregation, such as Sum and Count. In this chapter, you will sort grouped results and decide which total rows or columns appear.
Sort row labels alphabetically
Suppose your pivot table has Region in Rows and Revenue in Values. Google Sheets usually sorts region names alphabetically. To change the order:
- Click any cell in the pivot table.
- Open the Pivot table editor.
- Under Rows, expand
Region. - Set Sort by to
Region. - Set Order to A → Z or Z → A.
This sorts the labels without changing the revenue calculation.
Sort groups by a value
Alphabetical order is often less useful than ranking. To place the highest-revenue region first:
- Expand the row field under Rows.
- Open Sort by.
- Choose the value field, such as
SUM of Revenue. - Set Order to Z → A.
The pivot table now ranks regions by their calculated revenue. The row labels move, but the source records do not change.
If the sort appears wrong, check which value field you selected. A pivot table with several measures might contain SUM of Revenue, AVERAGE of Revenue, and COUNTA of Order ID. Each produces a different ranking.
Control grand totals
Grand totals answer a useful question: “What is the total across all displayed groups?” They can also distract readers when the table is used as a report.
In the editor:
- Under Rows, clear Show totals to hide the total row for row groups.
- Under Columns, clear Show totals to hide the total column for column groups.
- Leave totals enabled when readers need to compare each group with the overall result.
For example, a table with Region in Rows and Quarter in Columns can show both a total for each region and a total for each quarter. If the report should display only the region-by-quarter grid, turn off the relevant totals.
A total can be misleading when filters are active. The grand total usually reflects the records currently included in the pivot table, not necessarily every record in the source sheet. Label filtered reports clearly so readers know what the total represents.
A practical decision
| Reporting need | Sort by | Show totals? |
|---|---|---|
| Find the largest region | Sum of Revenue, descending | Yes |
| Provide an alphabetical lookup | Row label, ascending | Optional |
| Show a clean matrix for a presentation | Row label or selected measure | Often no |
When a pivot table has nested row fields, test the sort after adding each field. A sort at one level can make the order of groups harder to read at another level.
Exercise
You have a pivot table with Region in Rows and SUM of Revenue in Values. How do you place the highest-revenue region at the top and remove the overall total row?
Show answer
In the Region section of the Pivot table editor, set Sort by to SUM of Revenue and Order to Z → A. Then clear Show totals under Rows.