Unique Code for Same Names Appearing in a Column

manoj18071965

Board Regular
Joined
Sep 16, 2011
Messages
65
I have an excel where in D column Same name are appearing multiple times. They are already grouped I just need to provide unique_id code (1, 2, 3...) for each group as shown in below example in column E:

Col A Col B Col C Col D Col E
[TABLE="width: 486"]
<colgroup><col span="2"><col span="2"><col></colgroup><tbody>[TR]
[TD]Sr no[/TD]
[TD]year[/TD]
[TD]name[/TD]
[TD]clean_name[/TD]
[TD]unique_id[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD="align: right"]2002[/TD]
[TD]YOON, ALBERT,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD="align: right"]2003[/TD]
[TD]YOON, ALBERT,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD="align: right"]2004[/TD]
[TD]YOON, ALBERT,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD="align: right"]2005[/TD]
[TD]YOON, ALBERT,*[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD="align: right"]2006[/TD]
[TD]YOON, ALBERT H.,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD="align: right"]2007[/TD]
[TD]YOON, ALBERT H.,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="align: right"]2008[/TD]
[TD]YOON, ALBERT H.,[/TD]
[TD]YOON, ALBERT[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD="align: right"]1980[/TD]
[TD]WARREN, ELIZABETH,[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD="align: right"]1981[/TD]
[TD]WARREN, ELIZABETH,[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD="align: right"]1983[/TD]
[TD]WARREN, ELIZABETH,[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD="align: right"]1984[/TD]
[TD]WARREN, ELIZABETH,[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD="align: right"]1985[/TD]
[TD]WARREN, ELIZABETH,[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD="align: right"]1987[/TD]
[TD]WARREN, ELIZABETH, F[/TD]
[TD]WARREN, ELIZABETH[/TD]
[TD="align: right"]2[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Assuming that this is going in column D, and the first line of data is row 2 (header in row 1), place a 1 in cell E2, and then place the following formula in cell E3 and copy down for all rows:
Code:
=IF(D3=D2,E2,E2+1)
 
Upvote 0
In provided example i inserted 1 & 2 values in column E manually. I want this value to be populated with formula
Did not see the formula I provided above?
If you do not like having to place a 1 in the first cell only (E2), you could use this formula in all cells instead:
Code:
=IF(ROW()=2,1,IF(D2=D1,E1,E1+1))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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