At a loss: Finding & modifying duplicate cells

1 reply [Last post]
User offline. Last seen 2 years 35 weeks ago. Offline
Joined: 09/10/2010
Posts: 1

Hello,

I've managed to automate enough things to make life easier for myself, however I'm completely without a clue regarding what I'd like to do now.

Spreadsheet

Simple 2 column sheet.  Example:

LastName FirstName|IDNumber

The Work I'd like to automate

Many users have two or more ID numbers (column B), so I have sections of the sheet that look like this:

Caliban Doc|1234
Caliban Doc|1247
Caliban Doc|1295

For my purposes, I have to add incemental numbers to column A like this:

Caliban Doc|1234
Caliban Doc 2|1247
Caliban Doc 3|1295

I'd love to not have to do that manually as the sheet is almost 600 lines long and the majority of users have multiple lines.

Any help is greatly appreciated.

Regards,

-Doc

 

User offline. Last seen 3 weeks 17 hours ago. Offline
Joined: 06/02/2008
Posts: 15
Try this Doc

As you seem to be familier with the basics, I will tell you how you can do it. If you need futher detailed help do feel free to let me know.

1) First find all the unique names

2) Loop through all the unique names and add a second loop to go through the list to add the suffix behind it.

Something like this

Sub test()

for UniqueNames = 1 to TotalNumberOfUniqueNames

for MainListNames = 1 to TotalNumberOfMainListNames

Counter = 1

if UniqueNames = MainListNames then Counter = Counter + 1

MainListNames = MainListNames & " " & Counter

end if

next MainListNames

next UniqueNames

end sub

I hope this helps.