Table of Contents
The function CODE in Excel is used to convert a given character into its corresponding numerical code value. To write this function, first select the cell where the result should be displayed, then type “=” followed by “CODE(” and the character or cell reference of the character to be converted. Finally, close the function with a closing parenthesis “)”. The resulting numerical code will be displayed in the selected cell. This function can be useful for data analysis and manipulation in Excel.
This article describes the formula syntax and usage of the CODE function in Microsoft Excel.
Description
Returns a numeric code for the first character in a text string. The returned code corresponds to the character set used by your computer.
Operating environment | Character set |
Macintosh | Macintosh character set |
Windows | ANSI |
Syntax
CODE(text)
The CODE function syntax has the following arguments:
Text Required. The text for which you want the code of the first character.
Example
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.
Formula | Description | Result |
=CODE(“A”) | Displays the numeric code for A | 65 |
=CODE(“!”) | Displays the numeric code for ! | 33 |
Cite this article
stats writer (2024). “How can I write the function CODE in excel?”. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-write-the-function-code-in-excel/
stats writer. "“How can I write the function CODE in excel?”." PSYCHOLOGICAL SCALES, 29 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-write-the-function-code-in-excel/.
stats writer. "“How can I write the function CODE in excel?”." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-write-the-function-code-in-excel/.
stats writer (2024) '“How can I write the function CODE in excel?”', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-write-the-function-code-in-excel/.
[1] stats writer, "“How can I write the function CODE in excel?”," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. “How can I write the function CODE in excel?”. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
