Microsoft Office Tutorials and References
In Depth Information
Text Manipulation Functions
For i = 2 To TextLen
If Mid(text, i, 1) = “ “ Then
ACRONYM = ACRONYM & Mid(text, i + 1, 1)
End If
Next i
ACRONYM = UCase(ACRONYM)
End Function
This function uses the Excel TRIM function to remove any extra spaces from the argument. The
first character in the argument is always the first character in the result. The For-Next loop
examines each character. If the character is a space, the character after the space is appended to
the result. Finally, the result converts to uppercase by using the VBA UCase function.
Does the text match a pattern?
The following function returns TRUE if a string matches a pattern composed of text and wildcard
characters. The ISLIKE function is remarkably simple, and is essentially a wrapper for the useful
VBA Like operator.
Function ISLIKE(text As String, pattern As String) As Boolean
‘ Returns true if the first argument is like the second
ISLIKE = text Like pattern
End Function
The supported wildcard characters are as follows:
?
Matches any single character
*
Matches zero or more characters
#
Matches any single digit (0–9)
[list]
Matches any single character in the list
[!list]
Matches any single character not in the list
The following formula returns TRUE because the question mark ( ? ) matches any single character.
If the first argument were “Unit12” , the function would return FALSE.
=ISLIKE(“Unit1”,”Unit?”)
The function also works with values. The following formula, for example, returns TRUE if cell A1
contains a value that begins with 1 and has exactly three numeric digits:
=ISLIKE(A1,”1##”)
 
Search JabSto ::




Custom Search