Counting Duplicates

bhieatza

New Member
Joined
Apr 27, 2016
Messages
18
Okay this should be an easy one. I need to make a function or macro that counts duplicates. The last three characters are numbers. So if it comes across:
Milk_001
Milk_001
It would be changed to
Milk_001
Milk_002
The problem i am running into is when I get to the 10th duplicate it reads:
Milk_0010 instead of Milk_010.
Thank you for the help!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Book1
ABC
135Milk_001Milk_Milk_001
136Milk_001Milk_Milk_002
137Milk_001Milk_Milk_003
138Milk_001Milk_Milk_004
139Milk_001Milk_Milk_005
140Milk_001Milk_Milk_006
141Milk_001Milk_Milk_007
142Milk_001Milk_Milk_008
143Milk_001Milk_Milk_009
144Milk_001Milk_Milk_010
145Milk_001Milk_Milk_011
Blad1
Cell Formulas
RangeFormula
B135=LEFT(A135,LEN(A135)-3)
C135=B135&TEXT(COUNTIF($B$135:$B135,$B135),"000")
 
Upvote 0
ABC
135Milk_001Milk_Milk_001
136Milk_001Milk_Milk_002
137Milk_001Milk_Milk_003
138Milk_001Milk_Milk_004
139Milk_001Milk_Milk_005
140Milk_001Milk_Milk_006
141Milk_001Milk_Milk_007
142Milk_001Milk_Milk_008
143Milk_001Milk_Milk_009
144Milk_001Milk_Milk_010
145Milk_001Milk_Milk_011

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Blad1

Worksheet Formulas
CellFormula
B135=LEFT(A135,LEN(A135)-3)
C135=B135&TEXT(COUNTIF($B$135:$B135,$B135),"000")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Wow. I am upset I did not think of that haha. Thanks for your help.
 
Upvote 0
ABC
135Milk_001Milk_Milk_001
136Milk_001Milk_Milk_002
137Milk_001Milk_Milk_003
138Milk_001Milk_Milk_004
139Milk_001Milk_Milk_005
140Milk_001Milk_Milk_006
141Milk_001Milk_Milk_007
142Milk_001Milk_Milk_008
143Milk_001Milk_Milk_009
144Milk_001Milk_Milk_010
145Milk_001Milk_Milk_011

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Blad1

Worksheet Formulas
CellFormula
B135=LEFT(A135,LEN(A135)-3)
C135=B135&TEXT(COUNTIF($B$135:$B135,$B135),"000")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Is this possible to do for multiple things such as:
Milk_001
Grapes_001
Milk_001
Grapes_001
Milk_001
Corn_001
Grapes_001

Goes to:
Milk_001
Grapes_001
Milk_002
Grapes_002
Milk_003
Corn_001
Grapes_003
???
 
Upvote 0
Yes off course, same concept.


Book1
ABC
155Milk_001Milk_Milk_001
156Grapes_001Grapes_Grapes_001
157Milk_001Milk_Milk_002
158Grapes_001Grapes_Grapes_002
159Milk_001Milk_Milk_003
160Corn_001Corn_Corn_001
161Grapes_001Grapes_Grapes_003
Blad1
Cell Formulas
RangeFormula
B155=LEFT(A155,LEN(A155)-3)
C155=B155&TEXT(COUNTIF($B$155:$B155,$B155),"000")
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,280
Members
449,149
Latest member
mwdbActuary

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