Sub topic 6
Bucket numbers into intervals
A numeric column such as order size, price or age usually has too many distinct values to be useful as a row label. A pivot table with 400 distinct unit counts is just the source data again. A pivot group rule fixes this by sorting numbers into equal-width intervals, so each row of the pivot is a range such as 0 to 5 or 10 to 15 instead of a single number.
This chapter assumes you can build a basic pivot table and choose a summary function for a value field. It uses the Units column of the running example table.
What numeric grouping does
A numeric group rule is applied to a field that sits in the Rows or Columns area. Sheets replaces each distinct number in that field with the interval the number falls into. Every other field in the pivot is then summarized per interval.
The rule is built into the pivot table. It does not add a column to your source data and it does not change a single source cell. If you delete the pivot table, the rule goes with it.
Sheets calls this rule type a histogram group. The name is accurate: the result is the same set of bars a histogram would show, but as a table of rows.
The running example
Here is the source table again.
Date Region Product Units Revenue Cost
2026-01-05 West Widget 10 250 150
2026-01-19 East Widget 4 100 60
2026-02-02 West Gadget 7 420 245
2026-02-23 South Gadget 3 180 105
2026-03-09 East Gizmo 12 600 420We want to know how revenue behaves across small, medium and large orders, where "size" is the Units value. With only five rows the idea is easy to check by hand, and the same steps work with thousands of rows.
Create a numeric group rule
- Select any cell in the source range and choose Insert, then Pivot table. Create it on a new sheet.
- In the pivot editor, next to Rows, choose Add and select Units.
- Next to Values, choose Add and select Revenue. Leave the summary as SUM.
- The Rows area now lists each distinct Units value on its own line: 3, 4, 7, 10 and 12.
- Right-click one of the Units labels in the pivot table and choose Create pivot group rule.
- Choose the histogram option. Sheets asks for an interval size, and optionally a start and an end.
- Enter 5 as the interval size, 0 as the group start and 15 as the group end. Confirm.
The rows collapse into three intervals. Revenue is summed inside each one.
| Interval of Units | Source rows included | Sum of Revenue |
|---|---|---|
| 0 up to 5 | 4 and 3 units | 280 |
| 5 up to 10 | 7 units | 420 |
| 10 up to 15 | 10 and 12 units | 850 |
| Grand total | all five rows | 1550 |
The grand total of 1550 equals 250 + 100 + 420 + 180 + 600. A quick comparison of the grand total with a plain =SUM(E2:E6) on the source is a cheap check that no rows were lost.
The exact label text Sheets shows for each interval depends on the locale and the interval size. Read the labels in your own pivot, not in this table, to see where the boundaries fall.
The three settings
| Setting | Meaning | Typical choice |
|---|---|---|
| Interval size | Width of every bucket | A round number that suits the data, such as 5, 10 or 100 |
| Group start at | Lowest value that gets its own bucket | A round number at or below your minimum |
| Group end at | Highest value that gets its own bucket | A round number at or above your maximum |
Interval size is the only setting you must provide. If you leave the start and end empty, Sheets works them out from the smallest and largest values in the column.
Setting the start explicitly is worth the effort. If the minimum in your data is 3 and you leave the start empty, your first bucket may begin at 3 and every following bucket will begin at 8, 13 and so on. Those boundaries are correct but hard to read. Starting at 0 gives boundaries people recognize.
The group end matters when the data has a long tail. With an end of 15, a single order of 4,000 units does not create hundreds of empty intermediate buckets. How Sheets labels values that fall outside the start and end can differ from what you expect, so test it. Add a row with an extreme value to a copy of your sheet and look at where it lands before you rely on the report.
Where a boundary value falls
A value that sits exactly on a boundary, such as 10 with an interval of 5, has to go into one bucket or the other. Intervals of this kind are normally closed at the bottom and open at the top, so 10 belongs to the 10-to-15 bucket and not the 5-to-10 bucket. In the running example, 10 units and 12 units both land in the top bucket. Confirm this on your own data by checking that a known boundary row appears where you expect, because an off-by-one bucket is the most common reading error with this feature.
Edit or remove a rule
To change the interval size, right-click an interval label in the pivot table and choose Edit pivot group rule. Change the numbers and confirm. The pivot recalculates immediately.
To go back to individual values, choose the same menu and remove the rule. The field returns to listing every distinct number.
A field carries only one group rule at a time. If you add a manual group to a field that already has a histogram rule, the new rule replaces the old one. If you need two views of the same column, such as 5-wide and 10-wide buckets, put the pivot on two different sheets, or add the source column twice by creating a helper column (see below).
Requirements for the field
The histogram option appears only when Sheets sees the column as numeric. These problems stop it from working:
- Numbers stored as text. Values left-aligned in the cell, or imported with a leading apostrophe, are text. The option may be missing, or the text values may be grouped as separate items. Convert them with Data, then Data cleanup, or multiply by 1 in a helper column.
- Blank cells in the column. Blanks are not numbers. They show up as a blank item at the edge of the pivot, outside every interval. Fill them with 0 if zero is true, or filter the blank item out of the pivot.
- Mixed content. A single "N/A" in a column of numbers can make the whole column behave as text for grouping. Look for stray entries with a filter on the source column.
The chapter on source data preparation covers cleaning in more detail. Numeric grouping is where unclean data most often shows itself, so use these checks first when the option is missing.
When equal-width buckets are not enough
A histogram rule gives every bucket the same width. Business categories rarely work that way. You might want 1 to 4 units as "Small", 5 to 9 as "Medium", and everything from 10 as "Large", or income bands that widen at the top.
For uneven bands, add a helper column to the source data and group by it. Put this in G1 as the header and fill formulas down:
Order size=IFS(D2<5, "Small", D2<10, "Medium", TRUE, "Large")Fill the formula down the column, then include column G in the pivot source range. The pivot now treats Order size like any other text field. You lose automatic numeric ordering, because text sorts alphabetically: Large, Medium, Small. Prefix the labels with a number, such as "1 Small", "2 Medium", "3 Large", or use the manual sort option so that the order makes sense.
A compact alternative that avoids a long IFS is a lookup against a list of lower bounds:
=LOOKUP(D2, {0, 5, 10}, {"Small", "Medium", "Large"})The first array must be in ascending order. Values below the smallest bound return an error, which is a useful alarm for negative or mistyped numbers.
| Need | Use |
|---|---|
| Equal-width buckets, quick analysis | Pivot group rule (histogram) |
| Uneven bands with business names | Helper column with IFS or LOOKUP |
| The same bucket in several reports | Helper column, so the definition lives in one place |
| Bucket boundaries that change often | Helper column that reads its limits from cells |
Combine with calculated fields
Numeric buckets work with the calculated fields from the next chapters. Suppose you add the calculated field Profit with the formula =Revenue - Cost. With Units still grouped in intervals of 5, the pivot shows:
| Interval of Units | Sum of Profit |
|---|---|
| 0 up to 5 | 115 |
| 5 up to 10 | 175 |
| 10 up to 15 | 280 |
| Grand total | 570 |
You can check each figure by hand. The first bucket has (100 − 60) + (180 − 105) = 115. The second has 420 − 245 = 175. The third has (250 − 150) + (600 − 420) = 280. The sum, 570, equals total revenue 1550 minus total cost 980.
Be careful with ratios. A margin field written as =Profit / Revenue would be evaluated per source row, and the per-row results would then be added up per bucket, which gives a number that means nothing. Use the custom aggregated form described later for any ratio.
Two limits are worth knowing now:
- A calculated field is a value, not a dimension. You cannot drag Profit into Rows and apply an interval rule to it. To bucket a profit figure, first add a Profit column to the source data.
- The grouped field must come from a source column, so the bucket is based on each source row's value, not on the group total. A bucket of "Units 10 up to 15" holds rows whose Units are in that range. It does not hold groups whose summed Units are in that range.
Troubleshooting checklist
- No group option in the menu. Right-click a label in the pivot table body, not a cell in the editor panel. Confirm the field is in Rows or Columns.
- Histogram option missing. The column is probably text or mixed. Check alignment and run a cleanup.
- Unexpected first interval. The start was left empty and Sheets took the minimum. Set the start to a round number.
- A blank bucket or item. Source cells are empty. Fill them or filter the blank.
- Totals do not match the source. Compare the grand total with a plain SUM of the source column. A difference means the pivot range is too short, so extend the source range or use whole-column references.
- New rows missing from the pivot. The pivot source range is fixed. Edit the range in the pivot editor to include the new rows.
Summary
- A histogram group rule turns a numeric Rows or Columns field into equal-width intervals.
- Set interval size, and set a round start and end so labels are readable and outliers do not create dozens of buckets.
- The field must be truly numeric. Text numbers, blanks and stray labels break it.
- For uneven or named bands, use a helper column with IFS or LOOKUP.
- Calculated fields summarize per bucket, but they cannot themselves be bucketed. Check bucket totals against the source totals.
Exercise
A pivot table has Units in Rows, grouped with interval size 5, start 0 and end 15. Revenue is summed. A new source row arrives with 5 units and Revenue 90. Which interval does it join, and what is the new sum of Revenue for that interval, given that the 5-to-10 interval previously held only the 7-unit row with Revenue 420?
Show answer
Intervals are closed at the bottom and open at the top, so 5 units falls in the 5-to-10 interval, not 0-to-5. The new sum there is 420 + 90 = 510. Check the labels in your own pivot to confirm the boundary behavior.
Exercise
Your manager wants three bands for Units: Small (under 5), Medium (5 to 9) and Large (10 or more). Why is a histogram group rule the wrong tool, and what formula can you put in a helper column instead?
Show answer
A histogram rule produces equal-width buckets and cannot give custom names. Use a helper column such as =IFS(D2<5, "Small", D2<10, "Medium", TRUE, "Large"), include it in the pivot source range, and put it in Rows.
Exercise
The histogram option does not appear when you right-click a Units label. Name two likely causes in the source data and how you would check each.
Show answer
The Units column may contain numbers stored as text, which you can spot by left alignment or by testing with =ISNUMBER on a cell. It may also contain a stray non-numeric entry such as "N/A", which you can find by filtering the column for text values. Blank cells are a third possible cause.