Microsoft Office Tutorials and References
In Depth Information
Function EXACTWORDINSTRING(Text As String, Word As String) As
EXACTWORDINSTRING = “ “ & UCase(Text) & _
“ “ Like “*[!A–Z]” & UCase(Word) & “[!A–Z]*”
End Function
Figure 26-4 shows this function in use. Column A contains the text used as the first argument, and column B
contains the text used as the second argument. Cell C1 contains this formula, which was copied down the
Figure 26-4: A VBA function that determines whether a particular word is contained in a string.
Thanks to Rick Rothstein for suggesting this function, which is much more efficient
than my original function.
A workbook that demonstrates the EXACTWORDINSTRING function is available on this
book's website. The filename is exact word.xlsm.
Search JabSto ::

Custom Search