Excel Office

Excel How Tos, Tutorials, Tips & Tricks, Shortcuts

CODE function: Description, Usage, Syntax, Examples and Explanation

What is CODE function in Excel?

CODE function is one of TEXT functions in Microsoft Excel that returns a numeric code for the first character in a text string. The returned code corresponds to the character set used by your computer.

Worked Example:   How to abbreviate names or words in Excel
Operating environment Character set
Macintosh Macintosh character set
Windows ANSI

Syntax of CODE function


The CODE function syntax has the following arguments:

  • Text    Required. The text for which you want the code of the first character.
Worked Example:   Remove unwanted characters in Excel

Example of CODE function

Steps to follow:

1. Open a new Excel worksheet.

2. Copy data in the following table below and paste it in cell A1

Note: For formulas to show results, select them, press F2 key on your keyboard and then press Enter.

Worked Example:   Remove unwanted characters in Excel

You can adjust the column widths to see all the data, if need be.

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

Leave a Reply

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