Sub topic 4
Selecting Several Units at Once
The Grouping dialog lets you pick more than one time unit for the same date field. This chapter covers what Excel builds when you do, why the combination of units changes the numbers, and how to use the extra fields it creates. It assumes you can already group a date field by one unit, such as Months, and that your source dates are real dates and not text.
What happens when you select several units
Right-click a date in the Row Labels area and choose Group. The Grouping dialog has a By list with seven units: Seconds, Minutes, Hours, Days, Months, Quarters, and Years. Clicking a unit toggles it on or off, so you can highlight as many as you need. Months is selected by default.
When you select more than one unit, Excel does not build a single combined label. It builds a separate PivotTable field for each unit above the lowest one, and the original date field keeps the lowest unit.
Suppose your source column is named Order Date and you select Years, Quarters, and Months:
| Field in the field list | Contents | Source of the field |
|---|---|---|
| Years | 2023, 2024 | New field, created by grouping |
| Quarters | Qtr1 to Qtr4 | New field, created by grouping |
| Order Date | Jan to Dec | The original field, now showing months |
All three fields appear in the PivotTable Fields pane. Excel places them in the Rows area in order from largest unit to smallest, so the layout reads Years, then Quarters, then Order Date.
The new fields exist only in the PivotTable. Your source data does not change, and no columns are added to it.
A worked example
Assume a table named Sales with the columns Order Date, Region, and Amount. The orders run from October 2023 to March 2024.
- Insert a PivotTable from the table.
- Drag
Order Dateto Rows andAmountto Values (Sum). - Right-click any date in the row labels and choose Group.
- In the By list, click Months, Quarters, and Years so all three are highlighted.
- Leave Starting at and Ending at at their defaults (the earliest and latest dates in the data) and click OK.
In the compact layout, the PivotTable now shows each year with an expand/collapse button. Under each year are its quarters, and under each quarter are its months. Excel adds a subtotal at each level. The result looks like this:
| Row label | Sum of Amount |
|---|---|
| 2023 | 41,200 |
| Qtr4 | 41,200 |
| Oct | 12,500 |
| Nov | 14,300 |
| Dec | 14,400 |
| 2024 | 38,900 |
| Qtr1 | 38,900 |
| Jan | 11,800 |
| Feb | 13,100 |
| Mar | 14,000 |
The amounts are illustrative. What matters is the structure: each level's subtotal equals the sum of the level below it.
Why Years usually belongs in the selection
The most common mistake with several units is leaving Years out. Excel groups by the calendar position of each date, not by the full date. With Months selected and Years not selected, every January from every year lands in one Jan row.
With the example data, selecting only Months and Quarters gives this:
| Selection | Number of rows for Jan | What `Jan` contains |
|---|---|---|
| Months only | 1 | All January orders from every year in the data |
| Years and Months | 1 per year | January orders for that year only |
If your data covers only one year, the two give the same numbers. When a second year is added and the PivotTable is refreshed, the Jan row silently doubles up. The totals still add up to the right grand total, so nothing looks broken. Only the labels are misleading.
A good rule is to include Years whenever you include Months or Quarters, unless you deliberately want a seasonal comparison across years.
Using the generated fields independently
Because Years, Quarters, and the date field are separate fields, you can treat them like any other fields.
- Move them between areas. Drag Years to Columns and keep Order Date (months) in Rows. This gives one column of amounts per year and one row per month, which makes year-over-year comparison easy.
- Remove a level. Drag Quarters out of the Rows area if you want Years and Months only. The field still exists and you can drag it back at any time. The grouping itself is not undone.
- Filter them. Each field has its own filter arrow. You can filter Years to 2024 while keeping all months.
- Attach slicers. Insert a slicer for Years to switch years with one click.
- Change the subtotals. Right-click a field's label and clear Subtotal "Years" if you want a flatter table without subtotal rows.
If you drag Order Date (months) to Rows by itself and leave Years in Columns, the report is still correct. Each month cell is calculated using both the column's year and the row's month.
Units that do not combine freely
Not every combination behaves the same way.
Days with other units
The Number of days box is enabled only when Days is the only unit selected. This is the setting you use for seven-day weekly periods. If you highlight Days together with Months, the box turns gray and Excel groups by calendar day inside each month. You get months with individual dates under them, and you cannot make seven-day buckets.
If you want both weekly periods and a month or year level, group weekly periods on their own, or build a week-start helper column in the source data. Weekly grouping gets its own chapter.
Hours, Minutes, and Seconds
The time units appear only when the field contains time values. You can combine them with date units, for example Days, Hours, and Minutes. Each selected unit adds one field, so a long selection can produce a very tall PivotTable. If you only need a time-of-day pattern, selecting Hours alone is usually enough.
The range limits
Starting at and Ending at apply to the whole selection. If you set Ending at to 2024-02-29, any dates after that fall into a >2/29/2024 group at the bottom of the PivotTable. Dates before the start fall into a < group. Leave both at their defaults unless you want to trim the data deliberately.
Name collisions
Excel names the new fields after the units: Years, Quarters, and for time units Hours, Minutes, and Seconds. If your source table already has a column with one of these names, Excel adds a number and calls the new field Years2. This is easy to confuse with your own Years column in the field list. Check the field list after grouping and, if needed, rename the generated field by clicking its name in the Rows area and typing a new one.
Common problems
- Only one field appears after grouping. You probably selected a single unit. Right-click a date, choose Group again, and check that the highlighted items include more than one unit.
- Months repeat without a year above them. Years was not selected. Group again and add it.
- A month shows as
Janfor two different years. Same cause as above. Months were grouped without Years. - Labels such as
Qtr1look wrong for your calendar. The dialog is fixed to calendar quarters. Use a helper column for fiscal periods. - The Group command is grayed out or shows an error. One of the dates is text or blank. Dates stored as text are the usual cause. The next chapters on diagnosing grouping errors cover it, but a quick check is the formula below.
Checking the source and verifying a group
Before grouping, confirm that the dates are real numbers. This formula returns TRUE for a real date and FALSE for text:
=ISNUMBER(A2)Fill it down a spare column next to the data. Any FALSE cell must be fixed before the Grouping dialog will work. Delete the spare column afterward so it does not become part of your table.
After grouping, you can check one cell independently with SUMIFS. To confirm the Qtr1 2024 subtotal, assuming the table is named Sales:
=SUMIFS(Sales[Amount], Sales[Order Date], ">="&DATE(2024,1,1), Sales[Order Date], "<"&DATE(2024,4,1))The result should match the Qtr1 row under 2024. Using "<" with the first day of the next quarter, and not "<=" with the last day, avoids dropping orders that carry a time of day.
Summary of what to remember
- Selecting several units creates one new field per unit above the lowest, and the original field keeps the lowest unit.
- Excel orders the fields from largest unit to smallest in the Rows area.
- Always include Years when you include Months or Quarters, unless you want to merge the same month across years.
- Number of days is available only when Days is selected alone.
- Each generated field can be moved, filtered, and sliced on its own.
Exercise
A PivotTable groups Order Date by Months and Quarters only. The source data covers 2023 and 2024. A colleague reports that the Jan row total looks too large. What is the cause, and how do you fix it?
Show answer
Without Years selected, Excel groups by calendar position, so January 2023 and January 2024 are combined in one Jan row. Right-click a date in the row labels, choose Group, and add Years to the selected units. The PivotTable then shows a separate Jan under each year.
Exercise
You select Days, Months, and Years in the Grouping dialog and try to enter 7 in the Number of days box. The box is gray. Why, and what can you do to get seven-day periods?
Show answer
Number of days is enabled only when Days is the only selected unit. Combined with other units, Days groups by calendar day within each month. To get seven-day periods, clear Months and Years so only Days is selected and set Number of days to 7, or add a week-start helper column such as =A2-WEEKDAY(A2,2)+1 to the source data and group on that.
Exercise
After grouping Order Date by Years, Quarters, and Months, how many fields does the PivotTable Fields pane contain for this date column, and what are they?
Show answer
Three: Years, Quarters, and Order Date. Years and Quarters are new fields created by grouping. Order Date is the original field and now shows months.