Clearly I can't read. Hopefully I have it right now.
Sub blah2()
With Sheets("Account Definition Mapping")
ADMColumn = Application.Match(Sheets("Data").Range("J1").Value, .Rows(1), 0)
Set ADMTable = .Cells(1, ADMColumn).CurrentRegion
End With
Set ADMTable = Intersect(ADMTable, ADMTable.Offset(2))
ADMVals = ADMTable.Value
Set SceTable = Sheets("Data").Range("A1").CurrentRegion
Set SceTable = Intersect(SceTable, SceTable.Offset(1))
SceVals = SceTable.Value
Set myDestn = SceTable.Cells(1).Offset(SceTable.Rows.Count).Resize(, 3)
Set dict = CreateObject("scripting.dictionary")
For i = 1 To UBound(SceVals)
If Not dict.exists(SceVals(i, 2)) Then
dict.Add SceVals(i, 2), SceVals(i, 2)
For k = 1 To UBound(ADMVals)
Found = False
For j = i To UBound(SceVals)
If SceVals(i, 2) = SceVals(j, 2) Then
If ADMVals(k, 1) = SceVals(j, 1) Then
If ADMVals(k, 2) = SceVals(j, 3) Then
Found = True
Exit For
End If
End If
End If
Next j
If Not Found Then
With myDestn
.NumberFormat = "@"
.Value = Array(ADMVals(k, 1), SceVals(i, 2), ADMVals(k, 2))
.Interior.Color = 65535
Set myDestn = .Offset(1)
End With
End If
Next k
End If
Next i
End Sub
I have NOT thoroughly tested this.
Just be aware, that your sample data might be anomalous in 2 instances
1. If Model 1 is used, you end up with Acc No. 0786187364 having 2 Entity codes 0714, one for Legal Fees, one for Business Consulting (both originally present).
2. If model 2 is used, you end up with Acc No. 0786187436 having 2 Entity codes 0841, one Funding and Finance, one Legal Fees, again both originally present but after running the macro you end up with that Acc No. with a second Legal Fees Acc. Definition (Entity 0714) being added.