New Tool Radar

AI for Data & Spreadsheets

How to Group Dates by Month in a Pivot Table and Check the Groups

Group dates by month in a pivot table and check the groups match the source dates.

Schematic with three steps: Group the date field by months; Check each month's row count against the; Find the dates that did not group.

A pivot table can group daily dates into months, quarters and years, which turns a long list of days into a readable monthly summary. The grouping only works when the dates are real date values: a single date stored as text stops the whole column from grouping, and the pivot then shows one row per day. Check the grouping after building it, month by month.

What you need

  • The pivot table built on a date column
  • The source dates, with their range
  • A note of the months the summary should cover

Step 1: Group the date field by months

Right-click a date in the pivot table, choose Group, and select Months (and Years if the data spans more than one year). The pivot should now show one row per month instead of one per day.

Step 2: Check each month’s row count against the source

For each month in the pivot, count the source rows dated in that month and compare with the pivot’s count for the month. A month with too few rows has dates that fell outside the group.

Step 3: Find the dates that did not group

If a month is short, filter the source dates to that month and look for dates stored as text or in a different format. Convert them to real dates, refresh the pivot, and re-group.

Worked example: synthetic daily sales, January to March

The table below is a synthetic example. It shows the expected result of grouping dates by month; no workbook was opened.

Month Source rows Pivot rows
January 10 10
February 9 9
March 12 8
Ungrouped dates 4 Stored as text
Total 31 27 grouped, 4 ungrouped

Expected result (UNTESTED). January and February group correctly, but March shows 8 rows against 12 in the source because 4 March dates are stored as text. Converting them to real dates and refreshing gives 12 rows for March. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Grouping by month needs real date values; a text date will not group and will not error either.
  • A date field with blanks creates a (blank) group that can be mistaken for a month.
  • Grouping by months across two years merges the same month from both years unless Years is grouped too.
  • Ungrouping a date field returns it to daily rows; the grouping is not stored in the source.

Sources

See all