How to Group Data by Age Range in Excel (With Example)

Often you may want to group data based on age range in Excel.

Fortunately this is easy to do by using the Group function within an Excel pivot table.

The following example shows how to create the following pivot table in Excel that groups basketball players on based on age ranges:

Excel group data by age range

Example: How to Group Data by Age Range in Excel

Suppose we have the following dataset in Excel that shows the points scored by basketball players on various teams:

Suppose we would like to calculate the sum of points scored by the basketball players based on the following age groups:

  • 20-24
  • 25-29
  • 30-34

To do so, we can first create a pivot table by highlighting the cell range A1:C11, then clicking the Insert tab along the top ribbon, then clicking the PivotTable icon:

In the new window that appears, we will choose to place the pivot table in the Existing Worksheet in cell E1, then click OK:

In the PivotTable Fields panel that appears on the right side of the screen, drag Age into the Rows box and Points into the Values box:

The pivot table will be populated with the following values:

Notice that the Row Labels column currently lists out each unique age value.

To instead group the first column based on age ranges, right click any value in the first column and then click Group:

We’ll use 20 for Starting at, 34 for Ending at, and 5 for By:

Once we press OK, the age values in the first column will automatically be grouped into age ranges:

From the pivot table we can see:

  • The sum of points scored by players between ages 20 and 24 is 117.
  • The sum of points scored by players between ages 25 and 29 is 51.
  • The sum of points scored by players between ages 30 and 34 is 48.

Note: In this example we chose to calculate the sum of points by age group, but feel free to use another summary metric in the pivot table such as average, count, etc. 

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

Excel: Use IF Function to Calculate Age Buckets
Excel: How to Convert Date of Birth to Age
Excel: How to Calculate Age on a Specific Date

Leave a Reply

Your email address will not be published. Required fields are marked *