Microsoft Office Tutorials and References
In Depth Information
Text Manipulation Functions
The following formula returns TRUE because the first argument is a single character contained in
the list of characters specified in the second argument:
=ISLIKE(“a”,”[aeiou]”)
If the character list begins with an exclamation point ( ! ),the comparison is made with characters
not in the list. For example, the following formula returns TRUE because the first argument is a
single character that does not appear in the second argument’s list:
=ISLIKE(“g”,”[!aeiou]”)
To match one of the special characters from the table above, put that character in brackets. This
formula returns TRUE because the pattern is looking for three consecutive question marks. The
question marks in the pattern are in brackets so they no longer represent any single character:
=ISLIKE(“???”,”[?][?][?]”)
The Like operator is very versatile. For complete information about the VBA Like operator,
consult the Help system.
Does a cell contain a particular word
What if you need to determine if a particular word is contained in a string? Excel’s FIND function
can determine if a text string is contained in another text string. For example, the formula that
follows returns 5, the character position of rate in the string The rate has changed :
=FIND(“rate”,”The rate has changed”)
The following formula also returns 5:
=FIND(“rat”,”The rate has changed”)
However, Excel provides no way to determine if a particular word is contained in a string. Here’s
a VBA function that returns TRUE if the second argument is contained in the first argument:
Function EXACTWORDINSTRING(Text As String, Word As String) As Boolean
EXACTWORDINSTRING = “ “ & UCase(Text) & _
“ “ Like “*[!A–Z]” & UCase(Word) & “[!A–Z]*”
End Function
 
Search JabSto ::




Custom Search