CODE function

Returns a numeric code for the first character in a text string. The returned code corresponds to the character set used by your computer.



Argument Description
text The text for which you want the code of the first character.

ShowCharacter set

Operating environment Character set
Macintosh Macintosh character set
Windows ANSI

To make the following example easier to understand, you can copy the data to a blank sheet and then enter the function underneath the data. Do not select the row or column headings (1, 2, 3... A, B, C...) when you copy the sample data to a blank sheet.

Formula Description (Result)
=CODE("A") Displays the numeric code for A (65)
=CODE("!") Displays the numeric code for ! (33)

See also

CHAR function

List of all functions (by category)

Applies to:
Excel for Mac 2011