Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default How to assign unique number to column duplicates?

Hi All,
I need to assign a unique number to a set of duplicates all in one column in
Excel 2007.

so columnA will has about 9000 numbers, some of them unique, and others are
duplicates of 2-4 approx.

I used to conditional formatting to show which are duplicates, but need to
be able to assign a unique number to each set duplicates, that will be in
sequential order...

e.g.
ColumnA ColumnB(unique ID)
01233 0001
01233 0001
01234 -
01255 0002
01255 0002
etc....

Any ideas please? I don't know how to do programming, just formulas in excel.
Thanks
Heather


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default How to assign unique number to column duplicates?

This should do it even if you have more than 2 dups. Must be SORTED

option explicit
Sub uniquenums()
Dim i As Long
Dim un As Long
Dim mc As Double
un = 1
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
mc = Application.CountIf(Columns(1), Cells(i, 1))
If mc 1 And Cells(i - 1, 1) < Cells(i, 1) Then
Cells(i, 2).Resize(mc) = un
un = un + 1
End If
Next i
Columns(2).NumberFormat = "0000"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Heather" wrote in message
...
Hi All,
I need to assign a unique number to a set of duplicates all in one column
in
Excel 2007.

so columnA will has about 9000 numbers, some of them unique, and others
are
duplicates of 2-4 approx.

I used to conditional formatting to show which are duplicates, but need to
be able to assign a unique number to each set duplicates, that will be in
sequential order...

e.g.
ColumnA ColumnB(unique ID)
01233 0001
01233 0001
01234 -
01255 0002
01255 0002
etc....

Any ideas please? I don't know how to do programming, just formulas in
excel.
Thanks
Heather



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,180
Default How to assign unique number to column duplicates?

Excel 2007 Table
Choice of six different formulas.
http://www.mediafire.com/file/wdhcztdyu3m/12_23_09.xlsx

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default How to assign unique number to column duplicates?


Hi Herbert,
thanks for that, it looks like exactly what I need. I've tried copying the
formula into my table and then substituting your "NyNB" for my array, which I
drag teh cursor over to select. Excel doesn't seem to like this!?

How did you select your "NyNB"?

Thanks
Heather


"Herbert Seidenberg" wrote:

Excel 2007 Table
Choice of six different formulas.
http://www.mediafire.com/file/wdhcztdyu3m/12_23_09.xlsx

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign unique auto-generated number Silena K-K Excel Discussion (Misc queries) 0 January 28th 08 10:44 PM
How do I assign a unique ID number to an invoice sheet I created? Matt Excel Worksheet Functions 2 March 30th 06 06:08 PM
Showing a unique random number w/o duplicates tx12345 Excel Worksheet Functions 4 August 27th 05 02:51 AM
Count number of unique items in a column that contains duplicates Steembeem Excel Worksheet Functions 3 February 2nd 05 12:51 AM
How do I assign a unique tracking number in excel? anoyse Excel Worksheet Functions 2 November 20th 04 04:02 PM


All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"