Rename Duplicate Cells

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
573
Office Version
  1. 365
Platform
  1. Windows
Is it possible to have a macro compare the contents in column "C" and were it finds a duplicate entry the macro would add to the first entry "-Free".

For example

CB1270 - Free
CB1270

In the above example the macro would add the "-Free" to CB1270.

The duplicate entries are next to each other.

Thank you
 
Hello,

I now this thread is kind of old but is it possible to modify this such that it effectively counts upwards. Basically so that for first instance I can add ".01" for second instance I can add ".02" and so on?

Thanks,

Try this
Your data in columns C, result in column D

Code:
Sub Count_duplicate()
    Dim i As Long
    For i = 1 To Range("C" & Rows.Count).End(xlUp).Row
        Cells(i, "D").Value = WorksheetFunction.CountIf(Range("C1:C" & i), Cells(i, "C")) / 100
    Next
End Sub
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Thanks Dante! That almost does what I want. Ideally what I was trying to get to is such that column C is modified to have ".01" , ".02" , ".03" added on to the end of the column C entry (which is a text entry). So if C7 say is SD-0.01 and its the 3rd cell with SD-0.01 in it then it will be changed to SD-0.01.03. I also have column headers that I don't want to modify!
 
Upvote 0
Thanks Dante! That almost does what I want. Ideally what I was trying to get to is such that column C is modified to have ".01" , ".02" , ".03" added on to the end of the column C entry (which is a text entry). So if C7 say is SD-0.01 and its the 3rd cell with SD-0.01 in it then it will be changed to SD-0.01.03. I also have column headers that I don't want to modify!


Try this

Code:
Sub Count_duplicate()
    Dim i As Long
    For i = 1 To Range("C" & Rows.Count).End(xlUp).Row
        Cells(i, "D").Value = Cells(i, "C") & Mid(WorksheetFunction.CountIf(Range("C1:C" & i), Cells(i, "C")) / 100, 2)
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,773
Messages
6,126,822
Members
449,340
Latest member
hpm23

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