18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating Formulas That Manipulate Text 12<br />

A few other functions that are relevant to text manipulation appear in other function categories.<br />

Refer to Appendix A for a listing of the functions in the Text category — or you can peruse these<br />

functions in the Insert Function dialog box. Activate an empty cell, and choose Formulas ➪<br />

Function Library ➪ Insert Function. In the Insert Function dialog box, select the Text category and scroll<br />

through the list. To find out more about a particular function, click the Help On This Function link.<br />

CROSS-REF<br />

Most text functions are not limited to use with text; they can also operate with cells that contain values.<br />

You’ll find that Excel is very accommodating when it comes to treating numbers as text and text as<br />

numbers.<br />

The examples discussed in this section demonstrate some common (and useful) things you can do with<br />

text. You may need to adapt some of these examples for your own use.<br />

Determining whether a cell contains text<br />

In some situations, you may need a formula that determines the type of data contained in a particular cell.<br />

For example, you may use an IF function to return a result only if a cell contains text. The easiest way to<br />

make this determination is to use the ISTEXT function.<br />

If you’re browsing through the Text functions, you won’t find the ISTEXT function. The<br />

ISTEXT function is in the Information category, which is accessed from the More control in<br />

the Function Library group.<br />

NOTE<br />

The ISTEXT function takes a single argument and returns TRUE if the argument contains text and FALSE if<br />

it doesn’t contain text. The formula that follows returns TRUE if A1 contains a string:<br />

=ISTEXT(A1)<br />

Working with character codes<br />

Every character you see on your screen has an associated code number. For Windows systems, Excel uses<br />

the standard ANSI character set. The ANSI character set consists of 255 characters, numbered (not surprisingly)<br />

from 1 to 255.<br />

Figure 12.1 shows a portion of an Excel worksheet that displays all of the 255 characters. This example<br />

uses the Wingdings 3 font. (Other fonts may have different characters.)<br />

The companion CD-ROM includes a copy of this workbook, which also includes some simple<br />

VBA macros that enable you to display the character set for any font installed on your system.<br />

The file is named character set.xlsm.<br />

ON the CD-ROM<br />

Two functions come into play when dealing with character codes: CODE and CHAR. These functions may<br />

not be very useful by themselves, but they can prove quite useful in conjunction with other functions. I discuss<br />

these functions in the following sections.<br />

207

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!