EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • All Courses
    • All Specializations
  • Blog
  • Enterprise
  • Free Courses
  • All Courses
  • All Specializations
  • Log in
  • Sign Up
Home Excel Excel Resources TEXT and String Functions in Excel Excel CODE Function
 

Excel CODE Function

Madhuri Thakur
Article byMadhuri Thakur

CODE in Excel

CODE Function (Table of Contents)
  • CODE in Excel
  • How to Use the CODE Function in Excel?

CODE in Excel

Excel CODE function returns the ASCII value of a character or the first character in a cell. It returns the numeric code. ASCII stands for American Standard Code for Information Interchange.

 

 

CODE Formula

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Below is the CODE Formula:

CODE Formula in Excel

Where the supplied arguments are:

  • Text: It is the text string for which we want the code of the first character.

It is a worksheet function in excel. As a worksheet function, the CODE function can be used as part of a formula.

The CODE function is a built-in function in excel, and it falls under the TEXT Functions category. It found under the FORMULAS tab. Please follow the below steps:

  • Click on the FORMULAS tab.

CODE Function Step 1

  • Select the TEXT functions option. After clicking on the TEXT option tab, It will open a drop-down list of functions.

CODE Function Step 2

  • Click on the CODE function from the drop-down list.

 CODE Function Step 3

  • It will open a dialog box for FUNCTION arguments.

CODE Function Step 4

  • Enter the text field with the required text for which you want the code of the first character.

CODE Function Step 5

Description of the CODE function in Excel:

  • The returned code corresponds to the character set used by our computer may be different based on the operating systems used.
  • Windows uses the ANSI character set.
  • Macintosh uses the Macintosh character set.

How to use the CODE Function in Excel?

CODE Function is very simple to use. Let us now see how to use the CODE function in Excel with the help of some examples.

You can download this CODE Function Excel Template here – CODE Function Excel Template

CODE in Excel – Example #1

CODE Example 1-1

We will then apply the CODE formula and see the returning ASCII value of corresponding characters mentioned in the above data set.

CODE Example 1-2

The Result is:

CODE Example 1-3

Drag & drop the formula for the rest values, and it will give the ASCII numeric values of every character.

The Final Results is:

 CODE Example 1-4

CODE in Excel – Example #2

Now we will check the ASCII numeric values for numeric values, Mathematical operators.

CODE Example 2-1

Now we will apply the CODE formula and will see the returning ASCII value

CODE Example 2-2

The Result is:

CODE Example 2-3

Drag & drop the formula for the rest values, and it will give the ASCII numeric values.

The Final Results is:

CODE Example 2-4

Explanation:

  • ANSI code for negative values, it will ignore the “minus” symbol. 

CODE in Excel – Example #3

If we pass more than one character or a sentence as an argument of the CODE function, it will take the first character of the text and provide the ANSI value and ignore the rest of them.

Check the below data for this:

Example 3-1

Now we will apply the CODE formula and will see the returning ASCII value

Example 3-2

The Result is:

Example 3-3

Drag & drop the formula for the rest values, and it will give the ASCII numeric values

The Final Results is:

Example 3-4

Explanation:

  • 77 – it is the ANSI code for M.
  • 97 – It is the ANSI code for a.
  • The CODE function provides the ANSI code of the first character and ignores the rest text.

CODE in Excel – Example #4

Let’s assume the below data set:

Example 4-1

If we enclosed the text within inverted commas, then the CODE function will consider the first character “ (opening commas) and provide the ANSI value of this and will ignore the rest text.

Now we will apply the CODE formula and will see the returning ASCII value

Example 4-2

The Result is:

Example 4-3

Drag & drop the formula for the rest values, and it will give the ASCII numeric values.

The Final Results is:

 Example 4-4

Things to Remember

  • The CODE function gives the numeric value as a result
  • If the passing argument is left empty, the function will return the VALUE# error.
  • The CODE function in excel is introduced in Excel version 2000, and now it’s available in all versions of excel after that.
  • This function is the inverse of the CHAR function in excel. The CHAR function returns the character from a numeric ASCII value.
  • The output might be different based on the operating system.
  • If we pass a text or sentence as the function argument, it should not be enclosed in inverted commas.

Recommended Articles

This has been a guide to the Excel CODE function. Here we discuss how to use the CODE function in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. Excel CEILING Function
  2. LEFT in Excel
  3. Excel RAND Function
  4. VLOOKUP Function in Excel
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

Download CODE Function Excel Template

EDUCBA Login

Forgot Password?

EDUCBA

Download CODE Function Excel Template

EDUCBA

डाउनलोड CODE Function Excel Template

🚀 Limited Time Offer! - 🎁 ENROLL NOW