I am currently using the Macro below to compare data in 2 columns. I am looking to determine if the values in the 2 columns "Match" or do not ("No Match"). This Macro does not care the order of the values, just if they Match or don't Match.
I am looking for help to modify this Macro to ignore duplicate values in a particular cell.
Example:
Column A Column B
A;B;C C;B;A;C I need this to show as Match as I am not concerned if duplicate values are present. Just that the values are the same in both columns.
Thanks in advance for the help!
Dim Rng As Range, Dn As Range, Sp As Variant, S As Variant
Dim Txt1 As String, Txt2 As String
Set Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
For Each Dn In Rng
Txt1 = Replace(Dn.Value, " ", "")
Txt2 = Replace(Dn.Offset(, 1).Value, " ", "")
Sp = Split(Txt1, ";")
For Each S In Sp
If InStr(Txt2, Trim(S)) = 0 Or Len(Txt1) <> Len(Txt2) Then
Dn.Offset(, 2) = "No Match"
Exit For
Else
Dn.Offset(, 2) = "Match"
End If
Next S
Next Dn
End Sub
I am looking for help to modify this Macro to ignore duplicate values in a particular cell.
Example:
Column A Column B
A;B;C C;B;A;C I need this to show as Match as I am not concerned if duplicate values are present. Just that the values are the same in both columns.
Thanks in advance for the help!
Dim Rng As Range, Dn As Range, Sp As Variant, S As Variant
Dim Txt1 As String, Txt2 As String
Set Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
For Each Dn In Rng
Txt1 = Replace(Dn.Value, " ", "")
Txt2 = Replace(Dn.Offset(, 1).Value, " ", "")
Sp = Split(Txt1, ";")
For Each S In Sp
If InStr(Txt2, Trim(S)) = 0 Or Len(Txt1) <> Len(Txt2) Then
Dn.Offset(, 2) = "No Match"
Exit For
Else
Dn.Offset(, 2) = "Match"
End If
Next S
Next Dn
End Sub