Pivot Table Count Unique or Similar Values

%3CLINGO-SUB%20id%3D%22lingo-sub-2459897%22%20slang%3D%22en-US%22%3EPivot%20Table%20Count%20Unique%20or%20Similar%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2459897%22%20slang%3D%22en-US%22%3EHi%2C%20I%20was%20wondering%20if%20there%E2%80%99s%20a%20way%20to%20create%20a%20pivot%20table%20that%20counts%20unique%20values.%20I%20have%20tried%20adding%20to%20data%20model%20and%20selecting%20distinct%20count.%20This%20works%2C%20but%20then%20I%20run%20into%20a%20problem%20where%20two%20values%20are%20counted%20separately%20because%20they%20are%20written%20slightly%20different%2C%20but%20should%20be%20categorized%20together%20as%20one%20count.%20Normally%20I%20would%20try%20to%20group%20them%20together%20but%20then%20the%20group%20count%20would%20be%202%20instead%20of%201.%3CBR%20%2F%3E%3CBR%20%2F%3EExample%3A%3CBR%20%2F%3EGL109%3CBR%20%2F%3EGL109-title%3CBR%20%2F%3E%3CBR%20%2F%3EThese%20two%20values%20are%20actually%20the%20same%2C%20however%20they%20are%20written%20differently%20so%20excel%20counts%20them%20as%202.%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2459897%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECharting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2460831%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Count%20Unique%20or%20Similar%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2460831%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1081723%22%20target%3D%22_blank%22%3E%40Mchen95%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20hard%20to%20give%20anything%20but%20general%20advice%20given%20the%20very%20sparse%20description%20of%20your%20situation.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20thing%20you%20should%20do%2C%20if%20you%20haven't%20already%2C%20is%20to%20look%20into%20the%20still%20relatively%20new%20%3CSTRONG%3EUNIQUE%3C%2FSTRONG%3E%20function%2C%20which%20can%20extract%20from%20a%20long%20list%20the%20actual%20unique%20values%2C%20which%20can%20then%20be%20counted.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIF%20the%20aberrations%20are%20always%20following%20the%20variations%20in%20the%20example%20you%20gave%2C%20you%20could%20always%20look%20just%20at%20the%20first%20five%20characters%2C%20making%20use%20of%20the%20%3CSTRONG%3ELEFT%3C%2FSTRONG%3E%20function%20to%20strip%20off%20the%20%3CSTRONG%3EGL109%3C%2FSTRONG%3E%20from%20%22%3CSTRONG%3EGL109--anything%20else%22%3C%2FSTRONG%3E%20%26nbsp%3BBut%20if%20that%20was%20just%20an%20example%20and%20not%20representative%20of%20your%20actual%20data%2C%20you'll%20need%20to%20do%20something%20else%20to%20clean%20up%20the%20aberrations.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20a%20helpful%20video%20on%20%3CSTRONG%3EUNIQUE%3C%2FSTRONG%3E%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9I9DtFOVPIg%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor
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, bu...

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.