Google Sheets
CODE function in Google Sheets
Returns the numeric Unicode map value of the first character in the string provided.
=CODE(string)CODE syntax and parameters
One argument, one required.
- stringstringRequired
The string whose first character's Unicode map value will be returned.
CODE examples
Formulas you'll actually reuse.
The code of the first character — 32 means a hidden leading space:
=CODE(A2)Result
32Check the last character — 160 is a non-breaking space that TRIM won't remove:
=CODE(RIGHT(A2, 1))Result
160
CODE in Excel
Same name — your formula ports as-is.
Try CODE in the playground
Edit the example — nothing to install.
Preloaded with the CODE formula from Example 1 — change anything and watch it respond.
Loading the editor…
Related functions
More ways Google Sheets gets this done.
- ARABICComputes the value of a Roman numeral.TextExcel
- CHARConvert a number into a character according to the current Unicode table.TextExcel
- CLEANReturns the text with the non-printable ASCII characters removed.TextExcel
- CONCATENATEAppends strings to one another.TextExcel
- DOLLARFormats a number into the locale-specific currency format.TextExcel
- EXACTTests whether two strings are identical.TextExcel