Pivot Table Count Unique or Similar Values

Copper Contributor
Hi, I was wondering if there’s a way to create a pivot table that counts unique values. I have tried adding to data model and selecting distinct count. This works, but then I run into a problem where two values are counted separately because they are written slightly different, but should be categorized together as one count. Normally I would try to group them together but then the group count would be 2 instead of 1.

Example:
GL109
GL109-title

These two values are actually the same, however they are written differently so excel counts them as 2.
10 Replies
Hi,

Try adding another column that makes GL109 and GL109-title the same.
e.g. =LEFT(cellwithGL109-title, 5)
=GL109

@Mchen95 

 

It's hard to give anything but general advice given the very sparse description of your situation. 

 

One thing you should do, if you haven't already, is to look into the still relatively new UNIQUE function, which can extract from a long list the actual unique values, which can then be counted.

 

IF the aberrations are always following the variations in the example you gave, you could always look just at the first five characters, making use of the LEFT function to strip off the GL109 from "GL109--anything else"  But if that was just an example and not representative of your actual data, you'll need to do something else to clean up the aberrations.

 

Here's a helpful video on UNIQUEhttps://www.youtube.com/watch?v=9I9DtFOVPIg

 

Learn everything about our brand-new Dynamic Arrays and how you can use them to build advanced spreadsheets. Arrays (CSE) have long been present in Excel, but were limited to power users. With Dynamic Arrays we have rebuilt the calc engine, effectively turning all formulas into array formulas ...

Well my issue is this:
- trying to tally students for a class.
- while it shows the subtotal, it also shows the count 1 for each student row:

Class 1Name11
 Name21
 Name21
 Class 1 total3
Class 2Namex1
 Namey1
 Namez1
 Class 2 total3


Showing all the 1s do not make sense and make the report hard to read.

Shall appreciate suggestion how to "not" showing the 1s.

@ElizabethMabrey 

If something like this

image.png

creating PivotTable add data to data model and create measure

Count Names:=IF( HASONEVALUE(Table1[Name]), "", COUNTROWS( Table1 ) )

Use it in PivotTable instead of default aggregation.

Sergei, thank you. I am a newbie in pivot table. I figured out to enable Power pivot and created the new measure  created;  but have difficulty in locating how to insert the measure field into the pivot table. I have looked up from ms excel forum, and https://www.howtoexcel.org/summarizing-text/, but could not find the proper way to insert the newly created measure. Please advice.

@ElizabethMabrey 

Measure is shown together with table fields, just drag it into Values

image.png

@Sergei Baklan   that's what I thought.  Since it did not show up in the pivot table, I suspect I created it under a wrong table. I'll see if I can figure out how to recreate under the right pivot table. 

@ElizabethMabrey 

You may create measure in Power Pivot interface; or right click on Table here

image.png

Yes, I tried that after reading thru online article.. Unfortunately, the Table name does not show up in "Choose fields to add to report" dialog window. Sigh!

@ElizabethMabrey 

You shall have some name which is source for PivotTable. It could be Table or Range, doesn't matter.