Assuming that the records are already ordered by date (i.e. oldest to newest), this might work for you:
Option Explicit
Public Sub FixBaseData()
Dim lastRow As Long
Dim thisRow As Long
Dim lookupTable As Object
Dim lookupKey As Variant
' Create the lookup table
Set lookupTable = CreateObject("Scripting.Dictionary")
' Find the last row of data
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
' Temporarily turn off the screen updating
Application.ScreenUpdating = False
' Process from the latest record (at the bottom) to the oldest (at the top)
For thisRow = lastRow To 2 Step -1
' If the result isn't "Passed" then delete the row
If Cells(thisRow, "I").Value <> "Passed" Then
Cells(thisRow, "A").EntireRow.Delete xlShiftUp
Else
' Create a key for the lookup table based on the first and second names
lookupKey = Cells(thisRow, "E").Value & " " & Cells(thisRow, "F").Value
' Have we seen this name already?
If lookupTable.Exists(lookupKey) Then
' Yes - delete the row
Cells(thisRow, "A").EntireRow.Delete xlShiftUp
Else
' No - add the name to the lookup table
lookupTable.Add lookupKey, lookupKey
End If
End If
Next thisRow
' Restore screen updating
Application.ScreenUpdating = True
End Sub
Suggest you run it on a copy of your base data!
WBD
Bookmarks