Microsoft Office Tutorials and References
In Depth Information
Text Manipulation Functions
Figure 25-3: Calculating sales commissions based on sales amount and years employed.
Text Manipulation Functions
Text strings can be manipulated with functions in a variety of ways, including reversing the
display of a text string, scrambling the characters in a text string, or extracting specific characters
from a text string. This section offers a number of function examples that manipulate text strings.
The companion CD-ROM contains a workbook named text manipulation
functions.xlsm that demonstrates all the functions in this section.
Reversing a string
The following REVERSETEXT function returns the text in a cell backward:
Function REVERSETEXT(text As String) As String
‘ Returns its argument, reversed
REVERSETEXT = StrReverse(text)
End Function
This function simply uses the VBA StrReverse function. The following formula, for example,
returns tfosorciM :
Scrambling text
The following function returns the contents of its argument with the characters randomized.
For example, using Microsoft as the argument may return oficMorts, or some other random
Search JabSto ::

Custom Search