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?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It looks like it didn't upload the image so here it is again.
 

Attachments

  • excel.png
    excel.png
    4.6 KB · Views: 42
Upvote 0
Can you sort the data on the first column? It makes the formula much simpler.
 
Upvote 0
In that case I think you're stuck with something like this (assumes data in A from row 2, and formulas in B):

Excel Formula:
=IF(A2=A1,B1,IFERROR(VLOOKUP(A2,A$1:B1,2,0),max(B$1:B1)+1))
 
Upvote 0
In that case I think you're stuck with something like this (assumes data in A from row 2, and formulas in B):

Excel Formula:
=IF(A2=A1,B1,IFERROR(VLOOKUP(A2,A$1:B1,2,0),max(B$1:B1)+1))
Thanks Rory. That's brilliant. I don't understand the VLOOKUP element within that function. Could you explain what's happening there?..
 
Upvote 0
It's looking up the name in column A in all the rows above the current row to return any number that had already been assigned to that dataset. If that fails, it then assigns the next number in sequence.
 
Upvote 0
Thanks Rory, I've realised it's not quite going to do what I need to acheive. In hindsight, the sequence needs to be reset when a product (T101,T102,T103 etc) changes. I've changed the example data to reflect this in the attachment below.
 

Attachments

  • excel.png
    excel.png
    4.7 KB · Views: 31
Upvote 0
Sorry, I'm not following. Is that an example of what it should look like? If so, does that mean that the part before the hyphen is irrelevant?
 
Upvote 0
Sorry, I'm not following. Is that an example of what it should look like? If so, does that mean that the part before the hyphen is irrelevant?
The part before the hyphen is completely relevent. The product and data column is a concatenated string of a product and an attribute. The part before the hyphen is the product code and the part after is it's attribute. We can have the same attribute but for different products like in the example. I'm trying to create a count of the number of instances of each product attribute but only if the attribute changes. This count of each attribute will reset when the product code changes. I've altered the illustration to make it more clear. The data highlighted in green is the desired result. Thanks again for your help.
 

Attachments

  • excel2.png
    excel2.png
    30.4 KB · Views: 43
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,120
Members
453,021
Latest member
Justyna P

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