I have two columns B and C which has similar strings and I would like to compare between them and highlight the different parts
Example:
in column B: Hello my tutor Mr. Hans
In Column C: Hello my tuto Mr Hans
In that case Mr. is different from Mr so I need to highlight the difference or list the difference in another column (say D ) like that
Mr. / Mr
Another example:
In column B: I am very grateful to that forum
In Column C: I am so grateful to this forum
in that case there are two differences, so in column D, I expect
very / so * that / this
I have found this UDF
Code: Select all
Function TxtFilter(val1 As String, val2 As String, sep As String) As String
Dim arr1, arr2, dict As Object, x As Long
Set dict = CreateObject("Scripting.Dictionary")
arr1 = Split(val1, sep)
arr2 = Split(val2, sep)
For x = LBound(arr1) To UBound(arr1)
dict(arr1(x)) = 1
Next x
For x = LBound(arr2) To UBound(arr2)
If dict.Exists(arr2(x)) Then dict.Remove arr2(x)
Next x
TxtFilter = Join(dict.Keys, sep)
End Function
Thanks advanced for help