CODE function is a useful tool in Excel that allows you to find the numeric code of the first character in a given text string. This code represents the character’s position in the ASCII (American Standard Code for Information Interchange) character set.
Syntax
CODE(text)
Arguments
text | The text for which you want to find the numeric code of the first character. |
How to Use
The CODE function is straightforward to use. You only need to provide the ‘text’ argument, and it will return the numeric code for the first character in that text. Let’s see some examples:
1 |
=CODE("A") |
This formula will return the code 65 because ‘A’ is the first character in the text, and its ASCII code is 65.
1 |
=CODE("apple") |
Here, the function will return 97 because it calculates the code for the first character ‘a’ in the word ‘apple’.
1 |
=CODE("Excel") |
In this case, the result will be 69, as ‘E’ is the first character in the text “Excel” with an ASCII code of 69.
Remember, the CODE function is limited to finding the code for the first character in a text string. If you want to find codes for multiple characters, you can use a combination of functions like LEFT, MID, or a custom VBA (Visual Basic for Applications) macro.
Additionally, if you ever come across an unfamiliar term, you can search for its definition on a trusted website like Wikipedia.