CODE Function in Excel
Code Function in excel is used to find out the code of the character in the string, it finds out the code for the first character only so if we use this formula as =Code(“Anand”) and =Code(“An”) we will get the same result as 65 as the code for character A is 65.
- text: The text parameter is only and a mandatory parameter of the CODE Function. This parameter could be one single character, a string or any function which returns a text as a result.
How to Use CODE Function in Excel? (with Examples)
In this section, we will understand the use of CODE Function and will look at a few examples with help of actual data.
As you can clearly observe in the output section, the CODE function is returning the ASCII value of corresponding Characters written in the first column. ASCII value of “A” is 65 and “a” is 97. You can easily verify the ASCII values of every character of your keyboard form the Internet.
In the above example, we have applied CODE function on cells containing strings, so as you can see in output column, the CODE Function is returning the ASCII value of the first character of the sentence.
In example three, we have used another two functions LOWER and UPPER to use their return value as a parameter of the CODE function. The LOWER function returns the lower case of the character passed as a parameter, similarly UPPER returns the upper case of a character passed as a parameter.
Things to Remember
- The main purpose of the CODE function is to return the ASCII code of a character of the first character in any cell.
- The CODE Function is not that popular among the excel community but as an excel expert, you should be aware of this function, as you might find it handy in VBA Coding.
- It was first introduced in Excel 2000 and is available in all subsequent versions of excel.
- The parameter “text” in CODE Function is mandatory and if it left blank the function will return a #VALUE error which can easily be resolved by providing a proper character or string as a parameter to the function.
- The return type of CODE Function is a numeric value.
- It is actually the inverse of the CHAR function in excel. the CHAR function returns the corresponding character from a numeric ASCII value.
- You might observe a different output than the one shown in our examples on a Mac OS because Mac OS uses the Macintosh character set while windows use the ANSI character set.
CODE Function in Excel Video
This has been a guide to CODE in Excel. Here we discuss the CODE Formula in excel and how to use CODE function along with excel example and downloadable excel templates. You may also look at these useful functions in excel –