Skip to main content

Excel CODE function

The Microsoft Excel CODE function returns a numeric code of a character or the first character in a given text string cell.


=CODE (text)


Text (Required): The text for which you want to get the numeric code of the first character.

Return Value

Return a numeric code for a character.

Function Note

1. The #VALUE! Error occurs when the text argument is empty.

2. The returned code corresponds to the character set used by your computer.

 Operating environment  Character set
Macintosh Macintosh character set
Windows ANSI


The below example shows you how to use the CODE function in Excel.

1. Select a blank cell to output the code, copy the below formula into it and press the Enter key.

2. Drag the Fill Handle down to get all codes of specific characters.


1. You can directly enclose the text in the formula with double quotation marks.

2. The UPPER function and the LOWER function can help case-sensitive returning a numeric code for a character.

The Best Office Productivity Tools

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations