0

I do not recall where I found this code so I cannot give a proper attribution to its author but it fuzzy matches two columns of strings

I want to alter the code so that the LookWith column is in coluwn B not column E I have tried for sometime to do this but cannot get this to work without breaking the code

Thanks

The Original shape of the data the code is written for Original shape of data

Sub FuzzyMatch()
Dim F As Range, n As Long, c As Long, k As Long 'Taisir
Dim FN As String, SN As String, Z, s As Long, r As Long

For r = 2 To Range("A" & Rows.Count).End(xlUp).Row
SN = Replace(Cells(r, 1), ",", ""): Z = Split(SN): SN = Z(0)
Set F = Range("E:E").Find(SN)
If Not F Is Nothing Then
  s = F.Row: FN = Cells(s, 5): c = 1
  For n = 1 To UBound(Z): SN = Z(n)
   If Len(SN) < 3 Then GoTo GetNextn
     Set F = Rows(s).Find(SN)
      If Not F Is Nothing Then
       c = c + 1
         If c >= UBound(Z) - 1 Then
           If Cells(s, 6) <> "" Then k = k + 1 Else k = 6
             Cells(s, k).Resize(1, 2).Value = Cells(r, 1).Resize(1, 2).Value: End If
         GoTo GetNext: End If
GetNextn: Next n: End If
GetNext: Next r

End Sub
Community
  • 1
  • 1
xyz
  • 2,253
  • 10
  • 46
  • 68

0 Answers0