By default, a pivot table shows only data items that have data. When a pivot table is set up to show months, this means that months can "disappear" if the source data does not contain data in that month. In the example shown, a pivot table is used to count the rows by color. There is no data in the months of March and May, so normally these columns would not appear. However, the pivot table shown in the example has been configured to force the display all months between January and June.
Fields
The pivot table shown is based on two fields: Date and Color:
The Color field is configured as a row field, and a value field. In the Values area, the Color field has been renamed "Count" and set to summarize by count:
The Date field is grouped by Months only:
To force display of months with no data, the Date field has "Show items with no data" enabled:
Date filter is set to display only desired months:
To force the pivot table to display zero when items have no data, a zero is entered in general pivot table options:
Steps
- Create a pivot table
- Add Color field the Rows area (optional)
- Add Date field to Columns area
- Group Date by Months
- Set Date to show items with no data in field settings
- Filter to show only desired months
- Add Color field to Values area
- Rename to "Count" (optional)
- Change value field settings to show count if needed
- Set pivot table options to use zero for empty cells
Notes
- Any non-blank field in the data can be used in the Values area to get a count.
- When a text field is added as a Value field, Excel will display a count automatically.