PDA

View Full Version : [SOLVED:] have to delete one to one duplicate entry in muliple columns



murali7197
10-24-2014, 11:17 PM
Hi All,

Please help me in solving the below.

I want to delete one to one duplicate entry in multiple columns.

for example, below is a table with column A and column B with few entries.

col A col B


col A
col B


0
1200


0
1200


0
1400


1200
0


1400
0


0
1400


0
1400


1400
0





I want 1200 in col B to be cancelled with 1200 in col A, 1400 in col B to be cancelled with 1400 in col A, and a fresh list in col C with removing one to one duplicates in col B.

example below.



col A
col B
col C


0
1200
0


0
1200
1200


0
1400
0


1200
0
0


1400
0
0


0
1400
0


0
1400
1400


1400
0
0





Please help me in solving the above.

p45cal
10-29-2014, 10:13 AM
try something along these lines:
Sub blah()
With Range("A2").CurrentRegion.Resize(, 3)
.Columns(3).Value = .Columns(2).Value
For Each cll In .Columns(1).Cells
Set dupFound = .Columns(3).Find(what:=cll.Value, LookIn:=xlValues, lookat:=xlWhole, searchformat:=False)
If Not dupFound Is Nothing Then dupFound.ClearContents
Next cll
.Cells(1, 3) = "Duplicates removed"
End With
End Sub

Dave
10-30-2014, 01:48 PM
Not that it matters but Hmmm...seems like previously there were more posts on this thread??????? Dave

Aussiebear
10-30-2014, 02:58 PM
Unfortunately, due to a hard drive failure we recently lost a number of posts in threads. Please accept our apologies, and repost where applicable or relevant to a thread.