Formualizer Docs
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
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
65
Extended mapping
Grid
CellValue
No inputs on Sheet1.
Formula
=
Result
Not evaluated yet.
Expected
128

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

arg1

Any · Scalar

Caps

PURE

Source

On this page