Microsoft Office Tutorials and References
In Depth Information
The ISTEXT function takes a single argument, returning TRUE if the argument contains text and FALSE if it
doesn't contain text. The formula that follows returns TRUE if A1 contains a string:
You can also use the TYPE function. The TYPE function takes a single argument and returns a value that indic-
ates the type of data in a cell. If cell A1 contains a text string, the formula that follows returns 2 (the code num-
ber for text):
Both the ISTEXT function and the TYPE function consider a numeric value that's preceded by an apostrophe to
be text. However, these functions do not consider a number formatted as Text to be text unless the Text format-
ting is applied before you enter the number in the cell.
This sounds very confusing (and it is), but in actual practice, it's very rare to need to identify the contents of a
cell as numeric or text.
Working with character codes
Every character that you see on your screen has an associated code number. For Windows systems, Excel uses
the standard American National Standards Institute (ANSI) character set. The ANSI character set consists of
255 characters, numbered from 1 to 255. An ANSI character requires one byte of storage. Excel also supports
an extended character set known as Unicode, in which each character requires two bytes of storage.
Figure 5-2 shows an Excel worksheet that displays all 255 ANSI characters. This example uses the Calibri font.
(Other fonts may have different characters.)
This book's website includes a copy of the workbook character set.xlsm. It has some
simple macros that enable you to display the character set for any font installed on
Two functions come into play when dealing with character codes: CODE and CHAR. These functions aren't
very useful by themselves. However, they can prove quite useful in conjunction with other functions. I discuss
these functions in the following sections.