Excel Pivot Table COUNT UNIQUE Values

There are two ways to “excel pivot table count unique values”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

Exact answer

In Excel: create the PivotTable with "Add this data to the Data Model" ticked, drag the field into Values, then Value Field Settings ▸ Summarize value field by ▸ Distinct Count.

On this page7
▤Annotated stepsExcel
1

Click inside the data and choose Insert ▸ PivotTable.

2

Tick Add this data to the Data Model and click OK.

3

Drag the field whose unique values you want to count into Values.

4

Click the field in Values ▸ Value Field Settings ▸ Distinct Count ▸ OK.

5

Without the Data Model: add a helper column =IF(COUNTIF($B$2:B2,B2)=1,1,0) and use Sum of that column.

Ctrl+CthenCtrl+Shift+V⌘+Cthen⌘+Ctrl+VPaste values · WindowsMac

What this does

A normal PivotTable can Count rows but not count each different value once. Distinct Count becomes available when the PivotTable is built on the Data Model, which you choose with a checkbox in the Create PivotTable dialog. The setting is fixed when the PivotTable is created, so an existing PivotTable without it has to be rebuilt. The Data Model option is not available in every Excel edition; where it is missing, a helper column that marks the first occurrence of each value gives the same result with an ordinary Sum. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. Treat “excel pivot table count unique values” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected pivot table shows up while it is still harmless. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That turns a data step that keeps your analysis trustworthy into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

An orders table has 10 rows for 4 customers. Insert ▸ PivotTable, tick Add this data to the Data Model, put Region in Rows and Customer in Values. Count of Customer shows 10; open Value Field Settings, choose Distinct Count, and it shows 4. Without the Data Model, add a column with =IF(COUNTIF($B$2:B2,B2)=1,1,0) and sum that column in the PivotTable. How many different customers, products or users per region is a different question from how many rows — and it is the one most reports actually need. If this is something you do often, add the command to the Quick Access Toolbar (right-click it on the ribbon and choose Add to Quick Access Toolbar) or learn its shortcut, so next time it is one click instead of a hunt through the menus.

In Google Sheets

This is a command rather than a formula, so there is no syntax to carry over. Google Sheets arranges its commands in menus across the top instead of a ribbon, names some of them differently and does not have every Excel command — look for the equivalent in the Sheets menus or its help before assuming the steps match. Nothing on this page is behind a login or a download: the exact answer is at the top, and the detail below it is there for when you need it. That is the whole promise here — the answer first, and just enough context to make it stick. The short version of “excel pivot table count unique values”: the answer is at the top of this page, and the sections above explain why each step matters, so a variation of the problem does not stump you. Try it once on a copy of a real file and the steps stick far better than re-reading them.

Common mistakes

  • Looking for Distinct Count on a PivotTable that was not created with the Data Model — rebuild it with the box ticked.
  • Using Count, which counts rows, not different values.
  • Helper-column counts that break when the PivotTable is split by a second field, because the first occurrence is counted only once overall.
  • Trailing spaces or different spellings making the same customer count twice.

Frequently asked questions

Why is Distinct Count missing from Value Field Settings?

The PivotTable was not added to the Data Model. Create a new PivotTable and tick Add this data to the Data Model.

Can I count unique values with a formula instead?

Yes — in Excel with dynamic arrays, =COUNTA(UNIQUE(B2:B11)) counts the different values in a range.

Can I change an existing PivotTable to Distinct Count?

Only if it was created on the Data Model. Otherwise insert a new PivotTable from the same data with the Data Model box ticked.

Other ways people ask this

People reach this page typing “count unique values excel pivot table”, “counting unique values in excel pivot table”, “excel pivot table how to count unique values” and “how to count unique values in excel pivot table”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “count unique values excel pivot table”, “counting unique values in excel pivot table”, “excel pivot table how to count unique values” all point at the one operation explained on this page, which is why they all lead here.