How to use the Excel CODE function

The Excel CODE function returns a numeric code for a given character.  For example, CODE(“a”) returns the code 97. The CODE function can be used to figure out numeric codes supplied to the CHAR function.

Syntax: =CODE(text)

The CODE function syntax has the following arguments:

  • text: The specified character to retrieve the ASCII value for. If there is more than one character, the function will return the ASCII value for the first character and ignore all of the characters after the first.

Example: Let’s look at some Excel CODE function examples and explore how to use the CODE function as a worksheet function in Microsoft Excel:

Syntax:  =CODE(A2)

Result:

=CODE(A3)
Result: 66

=CODE(A4)
Result: 67

=CODE(A5)
Result: 97

=CODE(A6)
Result: 98

=CODE(A7)
Result: 99

Add a Comment

Your email address will not be published. Required fields are marked *