Page 251 - Excel 2007 Bible
P. 251

17_044039 ch12.qxp  11/21/06  11:05 AM  Page 208
                                   Part II
                                              Working with Formulas and Functions
                                       FIGURE 12.1
                                      The ANSI character set (for the Wingdings 3 font).

                                             The CODE function
                                             Excel’s CODE function returns the character code for its argument. The formula that follows returns 65, the
                                             character code for uppercase A:
                                                  =CODE(“A”)
                                             If the argument for CODE consists of more than one character, the function uses only the first character.
                                             Therefore, this formula also returns 65:
                                                  =CODE(“Abbey Road”)

                                             The CHAR function
                                             The CHAR function is essentially the opposite of the CODE function. Its argument should be a value between
                                             1 and 255, and the function should return the corresponding character. The following formula, for exam-
                                             ple, returns the letter A:
                                                  =CHAR(65)
                                             To demonstrate the opposing nature of the CODE and CHAR functions, try entering this formula:
                                                  =CHAR(CODE(“A”))
                                             This formula, which is illustrative rather than useful, returns the letter A. First, it converts the character to
                                             its code value (65), and then it converts this code back to the corresponding character.






                                      208
   246   247   248   249   250   251   252   253   254   255   256