Sub topic 6
Calculating Values with Summarize by
Assume you can create a pivot table and understand rows of records, fields, and basic aggregations such as sum, count, and average. This chapter focuses on the Values section of the pivot table editor. Values are the measurements that Google Sheets calculates for each row and column group.
Choosing a value field
In the pivot table editor, select Add under Values, then choose a source column. Google Sheets adds a summary, often using SUM for numeric columns or COUNTA for text columns.
For a sales table, you might use:
| Region | Product | Units | Revenue |
|---|---|---|---|
| West | Pens | 10 | 25 |
| West | Paper | 4 | 20 |
| East | Pens | 8 | 20 |
If you add Revenue as a value and Region as a row, the pivot table calculates one revenue result for each region.
Selecting Summarize by
Open the value field in the editor and use Summarize by to choose the aggregation function. An aggregation combines several source values into one result.
| Summarize by | What it calculates | Useful for |
|---|---|---|
| SUM | Adds numeric values | Total revenue or units |
| COUNTA | Counts non-empty cells | Number of records with an entry |
| COUNT | Counts numeric cells | Number of numeric measurements |
| AVERAGE | Calculates the arithmetic mean | Average order value |
| COUNTUNIQUE | Counts distinct values | Number of different products |
| MIN or MAX | Finds the smallest or largest value | Lowest or highest sale |
The choice depends on the question. To ask “How much revenue did each region produce?”, use SUM. To ask “How many sales records does each region have?”, use COUNTA on a field that is filled for every record. To ask “How many different products did each region sell?”, use COUNTUNIQUE on Product.
Understanding blanks and data types
Summarize by does not treat every cell the same way.
- SUM ignores blank cells and adds numeric values.
- AVERAGE ignores blanks, but a text value is not a numeric measurement.
- COUNT counts numbers only.
- COUNTA counts any non-empty value, including text.
- A field containing numbers stored as text may not behave like a numeric field.
Check the source column before trusting the result. A column that mixes currency numbers with labels such as unknown can produce confusing averages or counts.
=AVERAGE(D2:D100)This formula is a direct check of an average for the same source range. It is useful when a pivot result looks unexpected.
Adding more than one calculation
You can add the same source field more than once. For example, add Revenue twice:
- Set the first value to SUM for total revenue.
- Set the second value to AVERAGE for average revenue per record.
Rename each value field when needed so the headings explain the results. A total and an average answer different questions, even though they use the same source column.
Exercise
A pivot table groups records by Region. You need the number of records for each region, including records whose Order ID is text. Which value field and Summarize by option should you use?
Show answer
Add Order ID under Values and choose COUNTA. COUNTA counts non-empty text or numeric cells.