Distinct List, generate unique identifier and match

mrs123

New Member
Joined
Oct 22, 2018
Messages
1
I have a long list of names that I need to arrange. I need to first create a distinct list that is not case-sensitive into a different worksheet in a workbook and to have a unique identifier added to the list of names. Then, I want the identifier and the name attached to that identifier to be placed next to the original long list that matches. See below:

[TABLE="width: 594"]
<tbody>[TR]
[TD][/TD]
[TD]Worksheet 1:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Long List[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Red apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Step 1[/TD]
[TD]Yellow Banana[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Red Apples[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Green Pears[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pink Grapefruit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]green Pears[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Long List[/TD]
[TD][/TD]
[TD]Distinct List Identifier[/TD]
[TD]Distinct List[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Red apples[/TD]
[TD][/TD]
[TD]Fruit01[/TD]
[TD]Red Apples[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Yellow Banana[/TD]
[TD][/TD]
[TD]Fruit02[/TD]
[TD]Yellow Banana[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Red Apples[/TD]
[TD][/TD]
[TD]Fruit03[/TD]
[TD]Green Pears[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Step 2[/TD]
[TD]Green Pears[/TD]
[TD][/TD]
[TD]Fruit04[/TD]
[TD]Pink Grapefruit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pink Grapefruit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]green Pears[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Red apples[/TD]
[TD]Fruit01[/TD]
[TD]Red Apples[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Yellow Banana[/TD]
[TD]Fruit02[/TD]
[TD]Yellow Banana[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Step 3[/TD]
[TD]Red Apples[/TD]
[TD]Fruit01[/TD]
[TD]Red Apples[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Green Pears[/TD]
[TD]Fruit03[/TD]
[TD]Green Pears[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Pink Grapefruit[/TD]
[TD]Fruit04[/TD]
[TD]Pink Grapefruit[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]green Pears[/TD]
[TD]Fruit03[/TD]
[TD]Green Pears[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 461"]
<tbody>[TR]
[TD]Thank you![/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi & welcome to MrExcel
No need for a second sheet you can do it like
Code:
Sub AddID()
   Dim cl As Range
   Dim i As Long
   
   With CreateObject("scripting.dictionary")
      .comparemode = 1
      For Each cl In Range("B2", Range("B" & Rows.Count).End(xlUp))
         If Not .exists(cl.Value) Then
            i = i + 1
            .add cl.Value, Array("Fruit" & Format(i, "00"), cl.Value)
            cl.Offset(, 1).Resize(, 2).Value = .Item(cl.Value)
         Else
            cl.Offset(, 1).Resize(, 2).Value = .Item(cl.Value)
         End If
      Next cl
   End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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