Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Group a Pivot Table by Age Range

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Grouping a pivot table by age range turns a long list of individual ages into meaningful buckets like 18–25, 26–35, and so on. This makes it much easier to spot patterns in your data, such as which age group buys the most or where your heaviest users fall. You’ll need a pivot table that already has a field containing numeric ages (or birth dates) and a version of Excel or Google Sheets that supports grouping.

What You'll Need

  • A pivot table with an “Age” field (numeric values) in the row or column area.
  • Excel 2013 or later, or Google Sheets (the steps differ slightly).
  • If your data has birth dates instead of ages, you’ll need to calculate age first (see FAQ).

Step-by-Step

In Microsoft Excel

  1. Click anywhere inside your pivot table to activate the PivotTable Tools on the ribbon.
  2. Make sure the Age field is placed in the Rows area (or Columns, if you prefer). If it’s not, drag it there from the field list.
  3. Right-click any cell that contains an age value (e.g., a row label like “23”).
  4. Choose Group from the context menu. (If Group is grayed out, your Age field is probably text – see Troubleshooting.)
  5. In the Grouping dialog box, set the Starting at and Ending at values. Excel will automatically suggest the minimum and maximum ages from your data, but you can override them to start at a round number like 18.
  6. Set By to the size of each age range (e.g., 10 for 10-year buckets). Excel will automatically create groups like 18–27, 28–37, etc. If you want custom ranges (e.g., 18–25, 26–35), you’ll need to use the manual method described in Tips.
  7. Click OK. Your pivot table now shows age ranges instead of individual ages.
  8. To rename a group (e.g., “18–25” to “Young Adults”), select the group label in the pivot table and type a new name directly. Press Enter.

In Google Sheets

  1. Select your pivot table by clicking any cell inside it.
  2. In the Pivot table editor panel on the right, ensure the Age field is in the Rows section.
  3. Click the Add button next to “Rows” if it’s not already there, and choose Age.
  4. Under the “Rows” section, click the drop-down arrow next to “Show as” and select Group by.
  5. Choose Numeric from the submenu.
  6. In the dialog that appears, enter the Minimum and Maximum values (or leave blank to use your data’s range).
  7. Set the Interval to the size of each bucket (e.g., 10).
  8. Click OK. The pivot table will now group ages into ranges.
  9. To rename a group, double-click the group label in the pivot table and type a new name.

Common Mistakes

  • Grouping a text field – If your Age column contains text (like “23 years”), Excel won’t let you group. Convert it to numbers first.
  • Grouping the wrong field – Make sure you right-click on an age value, not on a row label that’s a different field (e.g., a name).
  • Using “By” as the number of groups – The “By” box is the size of each range, not the count. For 5 groups, you’d set By to something like 10 if your data spans 50 years.
  • Forgetting to refresh after changing source data – If you add or remove ages, the pivot table won’t update automatically. Right-click and choose Refresh.
  • Not renaming groups – Excel’s automatic labels (e.g., “18-27”) are often fine, but if you rename them, the group boundaries don’t change – only the display label.

Tips

  • Custom age ranges – If you need specific ranges like 18–25, 26–35, 36–45, create a new column in your source data with a formula like =IF(A2<=25,"18-25",IF(A2<=35,"26-35","36+")) and use that column in your pivot table instead of the raw age.
  • Group by decade – For a quick overview, set “By” to 10. Excel will create 10-year buckets starting from your “Starting at” value.
  • Grouping by age and another field – You can group by age while also having another field (like gender) in the Rows area. The grouping will apply to the age field only.
  • Ungrouping – To revert to individual ages, right-click any group label and choose “Ungroup.”
  • Use a calculated field for age – If your data has birth dates, add a calculated field in the pivot table (or a helper column) that computes age as =DATEDIF(BirthDate, TODAY(), "Y") in Excel, or =DATEDIF(BirthDate, TODAY(), "Y") in Sheets. Then group that field.

Troubleshooting

“Group” is grayed out or not available. This almost always means the Age field is not numeric. Check the source data: all values must be numbers, not text. Use Excel’s “Text to Columns” or Google Sheets’ “Split text to columns” to convert. Also, ensure the field is in the Rows or Columns area – grouping won’t work if it’s only in the Values area.

The pivot table shows “(blank)” or “#N/A” after grouping. This happens when some source cells are empty or contain errors. Clean the data: replace blanks with 0 or remove those rows, and fix any #DIV/0! or #VALUE! errors.

Grouping works but the ranges are wrong (e.g., 18-27, 28-37). Excel’s automatic grouping uses the “By” value as the range size, starting from the “Starting at” value. If you want 18–25, 26–35, you must either set “By” to 8 (which gives 18–25, 26–33) or use the custom column method described in Tips.

After refreshing, the groups disappear. This can happen if you’ve manually renamed groups and then refresh. To avoid it, refresh before renaming, or use a custom grouping column in the source data.

Google Sheets doesn’t show “Group by” option. Make sure you’re using the pivot table editor, not the regular sheet menu. Also, the Age field must be numeric – if it’s a date, convert it to age first.

Frequently Asked Questions

Can I group by age ranges in Excel without a pivot table? Yes, you can use the “Group” feature in a regular range, but it’s easier with a pivot table. Alternatively, use a formula to create a categorical column.

How do I group ages into custom ranges like 18-25, 26-35? Create a new column in your source data with an IF formula that assigns each age to a range label, then use that column in the pivot table. Excel’s built-in grouping only creates equal-sized ranges.

What if my data has birth dates instead of ages? Calculate age first using a formula like =DATEDIF(BirthDate, TODAY(), "Y") in Excel, or =DATEDIF(BirthDate, TODAY(), "Y") in Google Sheets. Then add that as a field to your pivot table and group it.

Can I group by age range and also by gender at the same time? Yes, put Age in the Rows area and Gender in the Columns area (or vice versa). Group the Age field as described, and you’ll see age ranges for each gender.

Why does my pivot table show “(blank)” for some age groups? This usually means there are empty cells in the Age column of your source data. Fill them with a value (like 0) or remove those rows, then refresh the pivot table.

How do I change the age range size after grouping? Right-click any group label, choose Group, and change the “By” value. This will re-group all ages with the new range size.