# Counting Unique "Items"

#### gdseric

##### New Member
Need help! I have struggled with this for two days! I know it's right in front of me, but...

If I wanted to count the unique occurrences of items in a range (in Excel, obviously), how do I do it? For example, I have 516 rows of data in a worksheet (all participant/student activity related)...approximately 120 different students comprising 516 different activities. I can count the number of activities, no sweat, and can even categorize them by activity code, but how do I count the number of unique participants (with unique social security numbers) in the worksheet? 516 social security numbers in a list, but only about 120 students.

I am trying hard not to breach confidentiality, hence the vague question!

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Have you tried a pivot table?

On 2002-09-18 11:35, gdseric wrote:
Need help! I have struggled with this for two days! I know it's right in front of me, but...

If I wanted to count the unique occurrences of items in a range (in Excel, obviously), how do I do it? For example, I have 516 rows of data in a worksheet (all participant/student activity related)...approximately 120 different students comprising 516 different activities. I can count the number of activities, no sweat, and can even categorize them by activity code, but how do I count the number of unique participants (with unique social security numbers) in the worksheet? 516 social security numbers in a list, but only about 120 students.

I am trying hard not to breach confidentiality, hence the vague question!

Let A2:A520 house the SSNs.

Use one of:

=SUM(IF(LEN(A2:A520),1/COUNTIF(A2:A520,A2:A520)))

which you need to array enter using control+shift+enter (not just enter).

=COUNTDIFF(A2:A520)

which you enter normally.

http://longre.free.fr/english/index.html

That did it, Aladin! I knew it was something simple. Thanks for the referral on the add-in. Didn't have that one! Eric

is the LEN thrown in to prevent any DIV/0 error if there's a blank in the range ?

ta
Chris

On 2002-09-18 12:17, Chris Davison wrote:

is the LEN thrown in to prevent any DIV/0 error if there's a blank in the range ?

ta
Chris

Yes.

Replies
2
Views
115
Replies
3
Views
373
Replies
1
Views
485
Replies
0
Views
462
Replies
1
Views
251

1,218,832
Messages
6,144,735
Members
450,567
Latest member
Mplz

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back