EXCEL · PIVOT TABLE GUIDE

How to count unique values in a pivot table

Short answer: In Excel, tick “Add this data to the Data Model” when you create the pivot table, then choose Distinct Count. In Google Sheets, summarise by COUNTUNIQUE.

Updated 2 December 2026

A normal count tells you how many rows there are. If Ava places five orders, she is counted five times. A unique count, also called a distinct count, counts Ava once, which is what you want for questions like “how many different customers bought this product?”

In Excel for Windows

  1. Click inside your data and choose Insert, then PivotTable.
  2. In the dialog, tick Add this data to the Data Model. This is the step people miss.
  3. Put the group, such as Product, in Rows, and the field to count, such as Customer, in Values.
  4. Click the value field, choose Value Field Settings, and pick Distinct Count. Select OK.

In Google Sheets

  1. Create the pivot table with Insert, then Pivot table.
  2. Add Product to Rows and Customer to Values.
  3. Change Summarise by to COUNTUNIQUE.

In the NetPivotal builder

Choose the group in Rows, the field to count in Values, and Count unique as the calculation. It works the same on Mac and Windows, and blank cells are not counted as a value.

Count unique customers per product with sample ordersOpens the free pivot table builder with sample data

Why the totals don’t add up

With unique counts, the grand total is usually smaller than the sum of the rows, and that is correct. If Ava bought a Starter kit and a Refill pack, she is one customer in each product row but still one customer overall. Any tool that simply adds the rows together would count her twice.

Watch for near-duplicates

“Ava Shah”, “ava shah” and “Ava Shah ” with a trailing space look the same to a person. Excel and Sheets may treat some of them as different values, which inflates the count. Tidy names first, or check by putting the field in Rows to see every version listed.

SKIP THE MENUS

Make a pivot table in seconds

Paste cells from Excel or Google Sheets and pick your rows, columns and calculation. Free, no sign-up, and nothing is uploaded.

Open the pivot table builder →