With the character “a” in cell A1, the formula below returns the same result: The CODE function takes a single argument, text, which is normally a text value. If text contains more than one character, the CODE function returns a numeric code for the first character: The CODE function will handle numeric input for the numbers 0-9: Generally speaking, the number returned by CODE is the code for a character in ASCII decimal notation. The CODE function was designed to operate in an ASCII/ANSI world, and only understands how to map characters that correspond to numbers 0-255. For extended character support on modern Unicode systems, see the UNICODE function.

Reverse CODE

To get a character for a given numeric code, you can use the CHAR function: CHAR performs the reverse of CODE, taking a numeric code and returning the corresponding character.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.