MS Excel: How to use the CODE Function (WS)
This Excel tutorial explains how to use the Excel CODE function with syntax and examples.
Description
The Microsoft Excel CODE function returns the ASCII value of a character or the first character in a cell.
The CODE function is a built-in function in Excel that is categorized as a String/Text Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the CODE function can be entered as part of a formula in a cell of a worksheet.
Syntax
The syntax for the CODE function in Microsoft Excel is:
CODE( text )
Parameters or Arguments
- text
- The specified character to retrieve the ASCII value for. If there is more than one character, the function will return the ASCII value for the first character and ignore all of the characters after the first.
Returns
The CODE function returns a numeric value.
Applies To
- Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel CODE function examples and explore how to use the CODE function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following CODE examples would return:
=CODE(A1) Result: 116 =CODE(A2) Result: 84 =CODE(A3) Result: 84 =CODE("www.techonthenet.com") Result: 119
Advertisements