Subscribe for New Post Notifications

Techworld

How to use the CODE function in Microsoft Excel

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

CODE function

Summary

The CODE function is the inverse of the CHAR function. CODE Function in Excel is a function that returns the code number (ASCII code) specified by the character from the character set for your computer.
For example, CODE("A") returns the code 65. The CODE function can be used to figure out numeric codes supplied to the CHAR function.
The CODE Function is not that much popular among excel community but as an excel expert, you should be aware of this function.
The Code function is a built-in function in Excel that is categorized as a Text Function.

Purpose

Get the code for a character.

Return value

A numeric code representing a character.

What Does It Do ?

This function shows the ANSI value of a single character, or the first character in a piece of text.

Syntax

CODE function has one syntax and hence they can be written in Two different ways:

=CODE("text") or
=CODE(cell reference)

Parameters or Arguments

Text - The text for which you want a numeric code.
Cell reference: Reference to cells containing text.

Formatting

No special formatting is needed, the result will be shown as a number between 1 and 255.

Usage notes

  • CODE returns a numeric code for the first character in a text string. The code is based on the character set used by your computer.
  • We get VALUE# error – It occurs when: The text argument is left empty.
  • The return type of CODE Function is a numeric value.
  • Excel functions CHAR and UNICHAR will return the character for a given code whereas Excel functions CODE and UNICODE will do the opposite – give the code for a given character.

What is ASCII code?

ASCII stands for American Standard Code For Information Interchange, is a character encoding standard for the digital communications. For each character that can be typed, has a unique integer number associated with it, may it be a character set, digits, punctuation marks, special characters, or control characters. For example, the ASCII value for [space] is 032. ASCII values ranging from 097-122 are reserved for the alphabets a-z in lower case.

You can Download a list of all 255 numbers and the characters they represent.
CODE function

No comments:

Post a Comment