Tip: Other languages are Google-Translated. You can visit the English version of this link.
or

Register

or

## How to count unique values in pivot table?

By default, when we create a pivot table based on a range of data which contains some duplicate values, all the records will be counted as the first  screenshot shown, but,sometimes, we just want to count the unique values based on one column to get the second screenshot result. In this article, I will talk about how to count the unique values in pivot table.

Count unique values in pivot table with helper column in Excel 2007/2010

Count unique values in pivot table with Value Field Settings in Excel 2013 and later version

 Advanced Combine Rows（Combine duplicate rows and merge or do some calculations of corresponding values ): With Kutools for Excel’s Advanced Combine Rows utiltiy, you can quickly combine multiple duplicate rows into one record based on key columns, and it also can apply some calculations such as sum, average, count and so on for other columns. 1. Specify the key column that you want to combine other column based on; 2. Choose the separator or other calculations for your combined data. Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days.

#### Count unique values in pivot table with helper column in Excel 2007/2010

###### Save 50% of your time, and reduce thousands of mouse clicks for you every day!

In Excel 2007 or 2010, you need to create a helper column to identify the unique values, please do with the following steps:

1. In a new column besides the data, please enter this formula =IF(SUMPRODUCT((\$A\$2:\$A2=A2)*(\$B\$2:\$B2=B2))>1,0,1) into cell C2, see screenshot:

2. Then drag the fill handle over to the range cells that you want to apply this formula, and the unique values will be identified as follows:

3. Now, you can create a pivot table. Select the data range including the helper column, then click Insert > PivotTable > PivotTable, see screenshot:

4. Then in the Create PivotTable dialog, choose a new worksheet or existing worksheet where you want to place the pivot table at, see screenshot:

5. Click OK, then drag the Class field to Row Labels box, and drag the Helper field to Values box, and you will get the following pivot table which just count the unique values.

#### Count unique values in pivot table with Value Field Settings in Excel 2013 and later version

In Excel 2013 and later version, a Distinct Count function has been added in the pivot table, you can easily apply this feature.

1. Select your data range and click Insert > PivotTable, in the Create PivotTable dialog box, choose a new worksheet or existing worksheet where you want to place the pivot table at, and check Add this data to the Data model check box, see screenshot:

2. Then in the PivotTable Fields pane, drag the Class field to the Row box, and drag the Name field to the Values box, see screenshot:

3. And then click the drop down list from Values, choose Value Field Settings, see screenshot:

4. In the Value Field Settings dialog, click Summarize Value By tab, and then choose to click Distinct Count function, see screenshot:

5. And then click OK, you will get the pivot table which count only the unique values.

Related articles:

How to insert page break into pivot table?

How to show multiple grand totals in pivot table?

### Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

• More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
• No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
• Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds,
• Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
• 110,000 highly effective people and 300+ world-renowned companies' choice.
• 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

### Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

• Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
###### or post as a guest, but your post won't be published automatically.
• To post as a guest, your comment is unpublished.
· 1 months ago
sorry, this still doesn't provide a solution for me in excel 2010. You're =if(sumproduct() formula doesn't work. It misses the values for the if formula if you use it like you put it and it doesn't count unique values in my excel sheet if I add =if(>1,01;1;0)...
• To post as a guest, your comment is unpublished.
· 1 months ago
oh man... you saved me so so so much time !!!
thanks a lot !!!!
• To post as a guest, your comment is unpublished.
· 11 months ago
Distinct count Option not shown in summarize value by - Excel version 2013
• To post as a guest, your comment is unpublished.
· 9 months ago
Please verify that you have ticked the "Add this data to data model" check in the CreatePivot dialog box :)
• To post as a guest, your comment is unpublished.
· 9 months ago
I faced the same issue and then found the resolution.
Seems that it's available only when you tick the "Add this data to the Data Model" checkbox in the Create PivotTable dialog box.