Reputation:
I want to check if all words of one cell contained in sub words of another cell.
For example:
A1 contained in B1, but A2 not contained in B1.
Upvotes: 0
Views: 110
Reputation: 96753
The following UDF() will determine if all the words in cell Little appear in cell Big:
Public Function AreIn(Little As String, Big As String) As Boolean
Dim good As Boolean, aLittle, aBig, L, B
AreIn = False
aLittle = Split(LCase(Little), " ")
aBig = Split(LCase(Big), " ")
For Each L In aLittle
good = False
For Each B In aBig
If L = B Then
good = True
End If
Next B
If good = False Then Exit Function
Next L
AreIn = True
End Function
Here a "word" is a set of characters that do not include a space. The test is case-insensitive. Example:
Upvotes: 2