with an UDF,
if you have 2 "Cats" in the first string and only 1 "Cat" in the 2nd, is that false or true
for exemple "Cat cats dog mouse" and "cat dogs mouses" ???
Option Compare Text
Function Testing(string1, string2)
sp2 = Split(Replace(" " & string2 & " ", " ", "| |"))
sp1 = Split(Replace(" " & string1 & " ", " ", "| |"))
For i = 0 To UBound(sp1)
b = False
If Len(sp1(i)) > 1 Then
If UBound(Filter(sp2, sp1(i), 1, 1)) > -1 Then
b = True
Else
If StrComp(Right(sp1(i), 2), "s|", 1) = 0 And Not sp1(i) Like "|*#s|" Then
If UBound(Filter(sp2, Left(sp1(i), Len(sp1(i)) - 2) & "|", 1, 1)) > -1 Then
b = True
Else
If Not sp1(i) Like "|*#|" Then
MsgBox sp1(i) & vbLf & Replace(sp1(i), "|", "s|", 2)
If UBound(Filter(sp2, Replace(sp1(i), "|", "s|", 2), 1, 1)) > -1 Then
b = True
End If
End If
End If
End If
End If
Else
b = True
End If
If b = False Then Exit Function
Next
Testing = b
End Function
EDIT : as FlameRetired asked, this solution is "for the moment" not case sensitive.
Bookmarks