Don't give up just yet...
Let's first check what possible matches there are up to 2...
Look at results here and then we can get some feedback and possibly refine to get as close as...
There are members proficient in Regex which could get this perfected...Sadly I am not one of them...
Sub J3v16()
Dim Data, Chk, Str, Crit, Dict As Object, Fnd As Boolean, lr As Long, i As Long, ii As Long
Set Dict = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, 1).End(xlUp).Row
With Cells(7, 1).CurrentRegion.Resize(, 5)
.Cells(2, 2).Resize(lr, 3).ClearContents
Data = .Value
For i = 2 To UBound(Data)
Dict.Item(Data(i, 5)) = 1
Next i
For i = 2 To lr
If Dict.Exists(Data(i, 1)) Then
Data(i, 2) = Data(i, 1): Fnd = True
Else
Fnd = False
Str = Split(Data(i, 1), " ")
If UBound(Str) > 0 Then
For ii = 0 To UBound(Str)
If Len(Str(ii)) > 2 Then
Crit = IIf(ii = 0, Str(ii) & "*", "*" & Str(ii) & "*")
Chk = Application.Match(Crit, .Columns(5), 0)
If Not IsError(Chk) Then
Data(i, 3) = Data(Chk, 5)
Fnd = True
Exit For
End If
End If
Next ii
Else
Data(i, 2) = "NO MATCH"
End If
If Fnd = False Then Data(i, 2) = "NO MATCH"
End If
Next i
.Value = Data
End With
End Sub
Bookmarks