Summary

By default, a Pivot Table will count all records in a data set. To show a unique or distinct count in a pivot table, you must add data to the object model when the pivot table is created. In the example shown, the pivot table displays how many unique colors are sold in each state.

Fields

The pivot table shown is based on two fields: State and Color. The State field is configured as a row field, and the Color field is a value field, as seen below.

Pivot table unique count field configuration

In the Pivot Table, the Color field has been renamed "Colors", and "Summarize values by" has been set to "Distinct count":

Pivot table unique count value field settings

Data model

When the Pivot Table is created, the "Add this data to the Data Model" box is checked. This is what makes the distinct count option available.

Pivot table unique count add to data model

Steps

  1. Create a pivot table, and tick "Add data to data model"
  2. Add State field to the rows area (optional)
  3. Add Color field to the Values area
  4. Set "Summarize values by" > "Distinct count"
  5. Rename Count field if desired

Notes

  1. Distinct count is available in Excel 2013 and later

Support Exceljet

Many websites (including Exceljet) have lost over half their traffic in the past year because of the crushing impact of AI on web searches. Exceljet is still at it, publishing free content each week. If you find Exceljet helpful, you can support the site and go ad-free with the Exceljet Lifetime Pass. One payment, no subscription, and ads are gone forever. Plus, you get our Excel Shortcuts video course as a thank you.

Get the Lifetime Pass