Rename Duplicates

daily106

Board Regular
Joined
Dec 20, 2004
Messages
158
I searched on the board for duplicates and could not find what I needed.

How could I create a macro to rename the duplicate cells in a column and delete other cells that is not duplicate?

Is subtotal the only way to do this kinda job? Thank you all.
Book2
ABCD
1NameCount
2IXC2
3BAS1
4TGB1
5WAV5
6BAS3
7IDT3
8ITA9
9FRA8
10QWE8
11FRA7
12IDT6
13ITA13
14TGB2
15
16NameCount
17IXC
18BASYes
19TGBYes
20WAV
21BASYes
22IDTYes
23ITA
24FRAYes
25QWEYes
26FRA
27IDT
28ITA
29TGB
Sheet1
 
Ok, let me try your formula and let you know if I have any questions. Sorry about not being so clear. sometimes I am juggling so much stuff at work, I am rushing to ask a question and apply the answer to the work I do.

Anyhow, this forum is helping me so much!! THANK YOU ALL!!!
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Thank you Erik,

I tried your codes and it hides all duplicates. I need to delete unique cells in a column.

what would be the logic to rename the duplicates ?
After deleting all uniques, anything that appears in the column should be name to "Yes". Actually there is no logic since want to see where the duplicates are.

Hope it helps. Thank you.
sorry, I was distracted when posting my code :oops:
in fact the code should do automatically what shippey explained manually
here it is correctly
Code:
Option Explicit

Sub filter_duplicates()
'Erik Van Geit
'060317
'get list with data which appear more then once
'= uniques(range - uniques(range))
'no header needed
'autofilter with extra column would do the same
'START WITH
'a1 a2 a3 a4 a1 a1 a2 a2 a5 a6 a6 (in a column!)
'TO GET
'a1 a1 a1 a2 a2 a2 a6 a6

Dim LR As Long
Dim RNG As Range

Const CC As Integer = 1 'check column
Const FR As Long = 1    'first row with data

LR = Cells(Rows.Count, CC).End(xlUp).Row
Set RNG = Range(Cells(FR, CC), Cells(LR, CC))

'ActiveSheet.Copy
Application.ScreenUpdating = False
    Columns(CC).Insert
    With RNG.Offset(0, -1)
    .Formula = "=IF(COUNTIF(" & RNG.Address & "," & RNG(1).Address(0, 0) & ")>1,1,"""")"
    .Value = .Value
    On Error Resume Next
    .Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True '.Delete
    On Error GoTo 0
    End With
    Columns(CC).Delete
Application.ScreenUpdating = True
End Sub
it is HIDING the rows
if you find the result correct you can change Hidden to Delete (as you can see at the end of the line the word "delete" was already there !)

I do not see why you need a YES since all uniques will be deleted: can you explain ?

best regards,
Erik
 
Upvote 0
Thank you Erik and all!

I was able to use the code by editing them and changing them.
Again, thank you very much!!
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

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