Assign the Same Sequential Numbers to Duplicates

paynod

New Member
Joined
Mar 31, 2014
Messages
9
I'm using Excel 2007. I'm trying to reacreate the pattern shown in the sequence column. Could someone please give me a pointer as to how I could do this?
 
What version of Excel do you have to work with?
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Excel version is 2007. I know there are later versions of Excel which harness the UNIQUE Function. I was trying to use something similar with this VBA function in a module. Calling it within the formula but ran into problems and figured there may be a much easier way.

Function UNIQUE(rng As Range) As Variant()
Dim list As New Collection
Dim Ulist() As Variant

'Adding each value of rng to the collection.
On Error Resume Next
For Each Value In rng
'here value and key are the same. The collection does not allow duplicate keys hence only unique values will remain.
list.Add CStr(Value), CStr(Value)
Next
On Error GoTo 0

'Defining the length of the array to the number of unique values. Since the array starts from 0, we subtract 1.
ReDim Ulist(list.Count - 1, 0)

'Adding unique value to the array.
For i = 0 To list.Count - 1
Ulist(i, 0) = list(i + 1)
Next

'Printing the array
UNIQUE = Ulist
End Function
 
Upvote 0
You could use this array entered in C3 then filled down:

Excel Formula:
=IF(B3=B2,C2,IFERROR(VLOOKUP(B3,B$2:C2,2,0),MAX(IF(A$2:A2=A3,C$2:C2))+1))
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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