EDUCBA

EDUCBA

MENUMENU
  • Blog
  • All Courses
  • All in One Bundle
  • Login
Home Excel Excel Resources TEXT and String Functions in Excel Excel CODE Function

Excel CODE Function

Madhuri Thakur
Article byMadhuri Thakur

Updated August 14, 2023

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.

Start Your Free Excel Course

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

CODE Formula

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
MICROSOFT POWER BI Course Bundle - 8 Courses in 1
34+ Hours of HD Videos
8 Courses
Verifiable Certificate of Completion
Lifetime Access
4.5
MS Excel & VBA for Data Science Course Bundle - 24 Courses in 1 | 10 Mock Tests
87+ Hours of HD Videos
24 Courses
10 Mock Tests & Quizzes
Verifiable Certificate of Completion
Lifetime Access
4.5
All-in-One Financial Analyst Masters Training Program Bundle - 550+ Courses | 300+ Mock Tests | 2000+ Hours | Lifetime |
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
4.9
All-in-One Data Science Bundle - 400+ Courses | 550+ Mock Tests | 2000+ Hours | Lifetime |
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
4.7
Primary Sidebar
Popular Course in this category
MS Excel Course Bundle - 36 Courses in 1 | 13 Mock Tests
 137+ Hours of HD Videos
36 Courses
13 Mock Tests & Quizzes
  Verifiable Certificate of Completion
  Lifetime Access
4.9
Price

View Course
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Excel Charts
  • Excel Tips
  • All Tutorials
Certification Courses
  • All Courses
  • Excel VBA Course - All in One Bundle
  • VBA Course
  • Excel Data Analysis Course
  • Excel for Marketing Course
  • Excel for Finance Course
  • Excel for HR Training

ISO 10004:2018 & ISO 9001:2015 Certified

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

EDUCBA

Download CODE Function Excel Template

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

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

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

*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 Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

Download CODE Function Excel Template

EDUCBA

डाउनलोड CODE Function Excel Template

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more