How to create unique item ID's from a list where items might be duplicate (or more)

mikesch236

New Member
Joined
Mar 5, 2015
Messages
4
Hi all,

I've googled and searched for 2 days now but am not finding the answers I am looking for ...

I am trying to build a customer history list for a small bike shop. With each sale, the customer's name, address, invoice number, items bought etc. get automatically added to a sheet in the workbook.
Given that there are return customers, I need to build a macro that will find the duplicates and assign a unique customer ID to each individual customer - I do not want to delete duplicates (I've found snippets on how to do that) but need to keep all as the items bought will typically be different

sample data:

[TABLE="width: 404"]
<tbody>[TR]
[TD]Kd.Eintrag[/TD]
[TD]Re.Nr.[/TD]
[TD]Datum[/TD]
[TD]Adresse 1[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]150229[/TD]
[TD]20/02/2015[/TD]
[TD]Markus Vögl[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]150264[/TD]
[TD]24/02/2015[/TD]
[TD]Maria Beiwinkler-Stürzer[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]150281[/TD]
[TD]25/02/2015[/TD]
[TD]Franziska Schnell[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]150294[/TD]
[TD]26/02/2015[/TD]
[TD]Claudia Sahm[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]150316[/TD]
[TD]03/05/2015[/TD]
[TD]Mike Schroeder[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]150315[/TD]
[TD]03/05/2015[/TD]
[TD]Michaela Vollmer[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]150317[/TD]
[TD]03/05/2015[/TD]
[TD]Mike Schroeder[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]150318[/TD]
[TD]03/05/2015[/TD]
[TD]Mike Schroeder[/TD]
[/TR]
</tbody>[/TABLE]


Rows 1, 2, 3, 4 and 7 are unique and need to get a unique ID (eg. incrementally counting up from 1). Rows 6, 8 and 9 are the same customer so all 3 need to be assigned the same unique ID (ID's would be eg. in column E)

Any ideas on how to do this? I am fairly new at VBA programming so don't know what all is possible.

Thanks for any help!
Mike

PS: sorry, using Win 8.1 (but target is Win7) and Excel 2013
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
have you considered using a pivot table?

how do you know that you don't have 2 customers with the same name?
 
Upvote 0
sorry, error above .... obviously rows 1, 2, 3, 4 and 6 are unique, and 5, 7 and 8 are dupe's - I promise I'll learn to count soon ;)
 
Upvote 0
have you considered using a pivot table?

how do you know that you don't have 2 customers with the same name?

on the second question - there are more fields identifying the customer - street adress, town etc.

on #1 I've thought about a pivot, but given the sales customer list grows every day and will at some point (hopefully!) get very long, I'm not sure that's a viable solution long term

thanks!
 
Upvote 0
Here is a solution, but be aware that all excel solutions for your problem are only as good as the consistency of the data entry. If Mike Schroeder is ever entered as Michael Schroeder it will get a different number

Excel Workbook
ABCDE
1Kd.EintragRe.Nr.DatumAdresse 1
2115022920/02/2015Markus Vgl1
3215026424/02/2015Maria Beiwinkler-Strzer2
4315028125/02/2015Franziska Schnell3
5415029426/02/2015Claudia Sahm4
651503163/05/2015Mike Schroeder5
761503153/05/2015Michaela Vollmer6
871503173/05/2015Mike Schroeder5
981503183/05/2015Mike Schroeder5
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,708
Messages
6,174,005
Members
452,542
Latest member
Bricklin

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