This works when the keys are properly entered - In your sample there were 3 East 95's for instance.
But try it and see whether it works for you:
Sub hgcas(): Dim K, A, B, T, Key As String, r As Long, s As Long
Dim w1 As Worksheet, w2 As Worksheet
Set w1 = Sheets("Sheet1"): Set w2 = Sheets("Sheet2"): A = w1.UsedRange
K = w2.Range("H1").CurrentRegion: B = w2.Range("A1").CurrentRegion
T = w2.Range("L1").Resize(UBound(K, 1), UBound(B, 2) + 2)
With CreateObject("Scripting.Dictionary")
For r = 2 To UBound(K)
Key = K(r, 1) & K(r, 2): .Item(Key) = r
For s = 2 To UBound(A): Key = A(r, 1) & A(r, 3)
If .Exists(Key) Then
T(r, 1) = B(r, 1): T(r, 2) = K(r, 1): T(r, 3) = B(r, 2): T(r, 4) = B(r, 3)
T(r, 6) = B(r, 4): T(r, 7) = B(r, 5): T(r, 5) = T(r, 7) / T(r, 6): Exit For
End If: Next s: Next r
End With: w2.Range("L1").Resize(UBound(K, 1), UBound(B, 2) + 2) = T
End Sub
Bookmarks