corresponding code of a character in Excel
Corresponding ANSI code of a character


Return the corresponding ANSI code of a character.


The Excel CODE function display a unique number of each valid character based on the underlying set standard of American National Standards Institute (ANSI). The set of such characters is called the ANSI character set, and the numbers assigned to each character are called the ANSI codes.


= CODE(text)


text – A character represented by an ANSI code.

Return Value

An integer between 1 and 255.

Key Notes

The CODE function result is the opposite of the CHAR function.

The Microsoft Excel CODE function returns the number based on the ASCII value.

Return numbers depend upon the operating environment used by computer:

For example in Window, = CODE(!) (exclamation mark) in Excel returns 33 number.
For example in Window, = CHAR(<) (greater than Sign) in Excel returns 62 number.

Keep Reading Similar Functions:

Return the corresponding ANSI character of a number in Excel


The CHAR function display characters based on the underlying ANSI numeric codes. I.e. in Window, = CHAR(33) in Excel returns “!” (exclamation mark).

Read More »
Convert a text string without number format in Excel


The VALUE function converts valid numbers with various number formatting (number, date, $ etc.) into a code number. E.g. “=VALUE(“31-12-2017”)” returns “43100”.

Read More »