Sub topic 5
Grouping Data with Rows and Columns
Assume you already know how to select a range, create a pivot table, and use basic aggregations such as SUM, COUNT, and AVERAGE. This chapter focuses on how the Rows and Columns areas organize the categories in a pivot table.
Rows create groups
The Rows area creates a vertical list of groups. Each distinct value in the selected field becomes a row label.
Suppose your source data has these fields:
| Region | Product | Quarter | Revenue |
|---|---|---|---|
| West | Laptop | Q1 | 12000 |
| West | Monitor | Q1 | 5000 |
| East | Laptop | Q1 | 9000 |
If you add Region to Rows and Revenue to Values, Google Sheets groups records by region and calculates a revenue total for each group.
- Click a cell in the source data.
- Choose Insert > Pivot table.
- In the Pivot table editor, click Add next to Rows.
- Select Region.
- Under Values, add Revenue and leave Summarize by set to SUM.
The result has one row for West and one row for East. The order of the source records no longer matters because the pivot table groups matching values together.
Columns create a second grouping direction
The Columns area creates headings from left to right. It is useful when you want to compare a second category across every row group.
For example:
- Rows:
Region - Columns:
Quarter - Values:
Revenue, summarized bySUM
The pivot table can then show West, East, and other regions down the side. Q1, Q2, Q3, and Q4 appear across the top. Each intersection contains the revenue for one region and one quarter.
You can add more than one field to Rows or Columns. For example, place Region above Product in Rows. Sheets displays each region, with its products nested underneath it. The order matters: the field at the top level creates the broadest groups.
Choose the layout for the question
| Question | Rows | Columns | Values |
|---|---|---|---|
| How much revenue did each region produce? | Region | — | Revenue |
| How did each region perform by quarter? | Region | Quarter | Revenue |
| Which products sold in each region? | Region | Product | Count of Product |
Use Rows when the groups need to be read as a list. Use Columns when side-by-side comparison is more useful. Avoid placing too many fields in Columns because the table can become too wide to read.
Common grouping errors
- Using the wrong field: A misspelled or inconsistent value such as
Westandwestcreates separate groups. - Putting a measure in Rows: Revenue belongs in Values unless you intentionally want to group by exact revenue amounts.
- Reversing field order:
RegionaboveProductproduces a different hierarchy fromProductaboveRegion. - Expecting source formatting to define groups: Text that looks like dates or numbers may be treated as text. Clean the source field first.
Exercise
You need a table showing total revenue for every product in each region. Which fields should you place in Rows, Columns, and Values?
Show answer
Place Region and then Product in Rows, leave Columns empty, and place Revenue in Values summarized by SUM. If you need regions side by side instead, place Product in Rows, Region in Columns, and Revenue in Values.