ReferenceFunctionsText Functions
CODE
Returns a numeric code for the first character in a text string.
Summary
Returns the numeric code of the first character in text.
CODE mirrors Excel behavior with Windows-1252 compatibility mappings.
Remarks
- Only the first character is inspected.
- Empty text returns
#VALUE!. - Text-like coercion is applied to non-text scalar inputs.
- Known Unicode characters in the Windows-1252 extension map back to their Excel codes.
Examples
ASCII code
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
65
Extended mapping
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
128
Related functions
FAQ
What if the input text is empty?
CODE returns #VALUE! because there is no first character to evaluate.
Runtime metadata
Category
Text
Signature
CODE(arg1: Any)Arity
min 1, max 1
Arguments
arg1Any · Scalar
Caps
PURE
Source