Hi
try the following:
1. create a helper column C with the formula
=A1&B1
and copy this down for all rows
2. Use the macro on the following site:
http://www.cpearson.com/excel/deleti...eDuplicateRows
In your case change it to
Public Sub DeleteDuplicateRows()
'
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.
Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Col = ActiveCell.Column
If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 3).Value
If Application.WorksheetFunction.CountIf(Rng.Columns( 3), V) 1
Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
UK wrote:
In Excel I need a way to delete duplicate rows based on
more than one column.eg:
Original Data in a range of cells:
A 1
B 1
C 2
A 3
A 1
B 2
B 1
C 5
C 2
Resulting data after deleting duplicate rows should look
like below
A 1
B 1
C 2
A 3
B 2
C 5
Any help is appreciated. Thanks.