Using the function in a worksheet

When you enter a formula that uses the Reverse function, Excel executes the code to get the value. Here's an example of how you would use the function in a formula:

=Reverse(A1)

See Figure 10-1 for examples of this function in action. The formulas are in column B, and they use the text in column A as their argument. As you can see, it returns its single argument, but its characters are in reverse order.

Figure 10-1: Using a custom function in a worksheet formula.

Actually, the function works pretty much like any built-in worksheet function. You can insert it in a formula by choosing the Insert ^ Function command or by clicking the Insert Function button (to the left of the formula bar). Either of these actions displays the Insert Function dialog box. In the Insert Function dialog box, your custom functions are located, by default, in the User Defined category.

Notice that in a few cases, the result of using the Reverse function leads to surprising results. If the function is applied to a value, the result is the unformatted value. And when used with a Boolean value (TRUE or FALSE), the function does not maintain the case of the text.

You can also nest custom functions and combine them with other elements in your formulas. For example, the following (useless) formula uses the Reverse function twice. The result is the original string:

=Reverse(Reverse(A1))

0 0

Post a comment