Identify "nth" unique entry in a list

ellison

Active Member
Joined
Aug 1, 2012
Messages
356
Office Version
  1. 365
Platform
  1. Windows
Hi, is it possible to identify the "nth" unique entry in a list?
In other words: Column A has 8 different unique entries, some duplicated.
So for rows 7 to 8 where the Info is "charlie":
Col B "nth unique entry": charlie is the 5th unique entry on the list (i.e. 1,2,alpha,beta, charlie)
Col C "nth with count": there are 2 duplicates of charlie, so the 1st one (row 8) will be 5.1. And the second row (row 9) 5.2
If it helps, the info in Column is sorted A-Z


Book3
ABC
1Info (a-z)"nth unique entry""nth with count"
2111.1
3222.1
4222.2
5alpha33.1
6beta44.1
7charlie55.1
8charlie55.2
9delta66.1
10echo77.1
11echo77.1
12echo77.1
13foxtrot88.1
14foxtrot88.2
Sheet1




Hope this helps
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
For B2 formula will be:
Excel Formula:
=SUM(1/COUNTIF($A$2:A2;$A$2:A2))
I didn't understand column C
 
Upvote 0
For B2 formula will be:
Excel Formula:
=SUM(1/COUNTIF($A$2:A2;$A$2:A2))
I didn't understand column C
Sorry, I tried insertinug the formula into cell B2, but Excel is giving me an error message saying there's a problem with the formula....
 
Upvote 0
For Column C...

If Rows 7 and 8, the info is for Charlie.
So the first occurrence in Row 7 adds ".1" onto the end of the digit from Column B: "nth unique occurrence in a list".
And Row 8 would be the second occurrence. Therefore it would add ".2" to the "nth unique occurrence in a list".
Hope that helps
 
Upvote 0
How about
Fluff.xlsm
ABC
1Info (a-z)"nth unique entry""nth with count"
2111.1
3222.1
4222.2
5alpha33.1
6beta44.1
7charlie55.1
8charlie55.2
9delta66.1
10echo77.1
11echo77.2
12echo77.3
13foxtrot88.1
14foxtrot88.2
15
Data
Cell Formulas
RangeFormula
B2:C14B2=LET(d,FILTER(A2:A100,A2:A100<>""),r,ROWS(d),u,UNIQUE(d),x,XMATCH(d,u),HSTACK(x,x&"."&MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(d=TOROW(d)),SEQUENCE(r,,,0))))
Dynamic array formulas.
 
Upvote 0
How about
Fluff.xlsm
ABC
1Info (a-z)"nth unique entry""nth with count"
2111.1
3222.1
4222.2
5alpha33.1
6beta44.1
7charlie55.1
8charlie55.2
9delta66.1
10echo77.1
11echo77.2
12echo77.3
13foxtrot88.1
14foxtrot88.2
15
Data
Cell Formulas
RangeFormula
B2:C14B2=LET(d,FILTER(A2:A100,A2:A100<>""),r,ROWS(d),u,UNIQUE(d),x,XMATCH(d,u),HSTACK(x,x&"."&MMULT((SEQUENCE(r)>=SEQUENCE(,r))*(d=TOROW(d)),SEQUENCE(r,,,0))))
Dynamic array formulas.
Massive thanks, that works beautifully (& is working really quickly on larger sets of data too...) 💪 💪 💪 💪 💪 💪 💪
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
This is [ushing my luck massively, but is there a way that the digits that the counts give to inclue the leading zero's....

eg 0001 as opposed to 1
and 0001.1 as opposed to 1.1

(That would enable us to do extra sorting using these results later on).
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top