ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. Group Numbers Into Ranges in a Pivot Table

Group Numbers Into Ranges in a Pivot Table

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

To group numbers in a pivot table, put the number field in Rows, right-click one of its values and choose Group. Set Starting at, Ending at and By (the size of each group), such as 20, 59 and 10, then click OK. The pivot then shows one row per range, such as 20-29, instead of one row per number.

Key takeaways

  • Right-click a number in the Rows area, choose Group, and set Starting at, Ending at and By.
  • Every group is the same width. For uneven bands, group items by hand or add a helper column.
  • Cannot group that selection usually means the field has text, numbers stored as text, or blanks.
  • COUNTIFS with >= and < gives the same counts as a grouped pivot, and updates without a refresh.
On this page+
  1. Why group numbers in a pivot table?
  2. How to group numbers into ranges
  3. How Starting at, Ending at and By work
  4. Group numbers into uneven bands
  5. Why does Excel say "Cannot group that selection"?
  6. Check the groups with COUNTIFS
  7. Practise it

To group numbers in a pivot table, right-click a number in the row labels, choose Group, and tell Excel where to start, where to end and how wide each group should be. Instead of one row for every age, price or score, you get tidy ranges such as 20-29 and 30-39. This guide is for anyone who builds pivot reports, and it covers the Group dialog, uneven bands, the "Cannot group that selection" error and a formula check.

Why group numbers in a pivot table?#

A pivot table normally gives every distinct number its own row. With 500 employees, that could be 40 rows of ages, each with one or two people. Grouping rolls the numbers into ranges, often called bins or bands, so you can see the pattern at a glance.

The examples use this sheet in A1:C8:

ABC
1EmployeeAgeSales
2Ola234,100
3Ben375,200
4Mia456,100
5Raj293,900
6Lea525,800
7Tom314,700
8Zoe345,000

If you haven't built a pivot before, start with the pivot tables lesson and come back.

How to group numbers into ranges#

Build the pivot first, then group the number field:

  1. Click inside the data and choose Insert > PivotTable, then OK.
  2. Drag Age to Rows and Sales to Values. Drag Employee to Values too; because it is text, it shows as Count of Employee.
  3. Right-click any age in the pivot and choose Group. (You can also use PivotTable Analyze > Group Field.)
  4. In the Grouping box, set Starting at to 20, Ending at to 59 and By to 10.
  5. Click OK.

The pivot now looks like this:

Row LabelsSum of SalesCount of Employee
20-298,0002
30-3914,9003
40-496,1001
50-595,8001
Grand Total34,8007

Excel fills Starting at and Ending at with the smallest and largest values in the data. Round numbers such as 20 and 59 give cleaner labels than 23 and 52. With whole numbers, a group labelled 20-29 holds 20 through 29. More counting tricks are in how to count in a pivot table.

How Starting at, Ending at and By work#

The three boxes decide every group:

SettingWhat it doesExample
Starting atThe lowest value of the first group20
Ending atThe top of the last group59
ByThe width of every group10

Any value below Starting at or above Ending at goes into an extra group at the top or bottom, labelled with < or >. That is useful for outliers: set Starting at to 20 and every younger employee lands in one "under 20" group instead of many small ones.

Every group has the same width. You can't make one group 18-24 and the next 25-34 with these boxes. For that, see the section on uneven bands below.

Group numbers into uneven bands#

When the bands you need are not equal, you have two options.

Group items by hand. Select the items for one band (hold Ctrl on Windows or ⌘ on a Mac and click each one), right-click and choose Group. Excel makes a group called Group1. Click its label and type a better name, such as Under 30. Repeat for each band. This works for one-off reports but gets fiddly with many values.

Add a helper column. Put the band in the source data, then use that column in the pivot. With a small band table in G2:H5 (lower limits 0, 25, 35, 50 in G and labels in H), this returns each person's band:

Excel formula
=VLOOKUP(B2,$G$2:$H$5,2,TRUE)

TRUE asks for an approximate match: it finds the largest lower limit that is not above the age. The band table must be sorted from smallest to largest. The guide to VLOOKUP approximate match and the age group formula guide explain this pattern in detail. Because the band is now a normal column, it survives refreshes and works in any pivot.

Why does Excel say "Cannot group that selection"?#

This message means at least one item in the field is not a number. Excel can only group a field when every value is numeric. Check the source column for:

  • Blank cells. Fill them in or remove those rows.
  • Text, such as "N/A" or "unknown".
  • Numbers stored as text, often from imports. They usually sit on the left of the cell. Convert them with Data > Text to Columns > Finish, or with VALUE.

After fixing the data, refresh the pivot (Alt+F5 on Windows, or PivotTable Analyze > Refresh) and try Group again.

Two more things can block grouping. A pivot built with Add this data to the Data Model may not offer numeric grouping, so use a helper column there. And pivots made from the same source share their grouping: group ages in one pivot and a second pivot on the same data shows the same groups. Grouping dates follows the same rules, as the guide to grouping dates in a pivot table shows.

To undo grouping at any time, right-click a group and choose Ungroup.

Check the groups with COUNTIFS#

COUNTIFS gives the same counts as a grouped pivot and updates as soon as the data changes, with no refresh. Use the number column twice, once for the lower limit and once for the upper:

Excel formula
=COUNTIFS(B2:B8,">=30",B2:B8,"<40")

This returns 3, matching the 30-39 row. For the total sales in that band, swap in SUMIFS: =SUMIFS(C2:C8,B2:B8,">=30",B2:B8,"<40") returns 14,900.

Using >= for the lower limit and < for the next group's start means every value lands in exactly one band, even decimals like 39.5. Build a column of lower limits and the formulas fill down into a complete frequency table. The COUNTIFS function guide lists every argument.

Practise it#

Grouping and counting by band show up in pivot interview tasks and real HR or sales reports. Practise pivot tables in a live spreadsheet, then count by range with the COUNTIFS and SUMIFS lesson. Each lesson checks your work instantly. Then try the exercise on this page to count the 30-39 band with COUNTIFS.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Check one band of the grouped pivot with a formula. In F2, use COUNTIFS to count the employees aged 30 to 39 in B2:B8: 30 or more, and less than 40.

fx
ABCDEFG
1
Employee
Age
Sales
2
Ola
23
4100
Age 30-39
3
Ben
37
5200
4
Mia
45
6100
5
Raj
29
3900
6
Lea
52
5800
7
Tom
31
4700
8
Zoe
34
5000
9
10
11

Tip: Use the Age range twice: once with ">=30" and once with "<40". The answer is 3.

Practise this in a lesson

LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.

Frequently asked questions

How do I group numbers in a pivot table?

+

Put the number field in Rows, right-click any value, choose Group, enter Starting at, Ending at and By, and click OK. Each row of the pivot then shows a range instead of a single number.

Why can't I group numbers in my pivot table?

+

At least one item in the field is not a number, such as a blank cell, a word like N/A, or a number stored as text. Fix the source data, refresh the pivot and try again. Pivots added to the Data Model may not offer numeric grouping.

Can a pivot table group numbers into unequal ranges?

+

Not with the Group dialog, which makes every group the same width. Select the items for each band with Ctrl, right-click and choose Group, or add a helper column that assigns a band with a lookup.

How do I ungroup numbers in a pivot table?

+

Right-click any grouped item and choose Ungroup. The field goes back to one row per number.

Sources

  • Create a PivotTable to analyze worksheet data - Microsoft Support
  • COUNTIFS function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. Why group numbers in a pivot table?
  2. How to group numbers into ranges
  3. How Starting at, Ending at and By work
  4. Group numbers into uneven bands
  5. Why does Excel say "Cannot group that selection"?
  6. Check the groups with COUNTIFS
  7. Practise it

Keep reading

Data tools· 5 min read

Group Dates by Month or Year in a Pivot Table

To group dates in a pivot table, put the date field in Rows, right-click any date and choose Group. In the Grouping box, select Months and Years, then click OK. The pivot then shows one total per month, split by year. If Excel says it cannot group the selection, the date column holds blanks or text.

Data tools· 7 min read

How to Make a Frequency Table in Excel

A frequency table counts how often each value or range of values appears. In Excel, list the categories or bins in one column and count each with COUNTIF or COUNTIFS, for example =COUNTIFS(B2:B11,">=70",B2:B11,"<80"). You can also use the FREQUENCY function, or a PivotTable that groups numbers into bins for you.

Lookups· 7 min read

VLOOKUP Approximate Match for Tiers and Bands

A VLOOKUP approximate match uses TRUE as the 4th argument, like =VLOOKUP(B2,$F$2:$H$5,3,TRUE). It finds the largest value in the first column that is less than or equal to your number, so 62,000 lands in the band that starts at 50,000. The first column must be sorted from smallest to largest.

More on data tools

  • How to Make a Pivot Table From Multiple Sheets in Excel
  • Pivot Table Tricks: Subtotals, Filters and % of Total
  • Remove a Grand Total or Subtotal From a Pivot Table
  • How to Sort a Pivot Table in Excel
  • Show a Pivot Table in Tabular Form and Repeat Labels
  • How to Make a Radar Chart in Excel to Compare Scores
All data tools articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free