Related Function:

The CODE function converts the first character of a supplied text string into the associated numeric character set code used by your computer.

Syntax

=CODE(text)

Note: The character encoding used by your computer depends on the operating system used – Windows uses the ANSI character set, whereas Macintosh uses the Macintosh character set.

Arguments

Argument Description
text A text string, which is supplied to the function either directly or as a reference to a cell containing a string

Examples

  A B C D
1 Text Formula Result Notes
2 A =CODE(A2) 65 Uppercase “A” = ANSI number 65
3 Alpha =CODE(A3) 65 Returns the code value for the first character
4 * =CODE(A4) 42 Returns the code for the asterisk character
5 0ne
two
=CODE(MID(A5,4,1)) 10 Using MID function to get the CODE for the new line character, the 4th character in A5
6   =CODE(“a”) 97 Returns the code for the lowercase “a” character