The Google Sheets function CODE is a valuable tool for users needing to convert the first character of a string into its corresponding numeric Unicode value. This functionality is particularly useful in data manipulation, text analysis, and programming scenarios where understanding character encoding is essential.
Syntax
CODE(string)
- string: This is the text string from which you want to obtain the Unicode value of the first character.
Example #1
CODE("A")
This function retrieves the Unicode value for the character “A”, resulting in the value 65.
Example #2
CODE("😊")
This call returns the Unicode value for the emoji “😊”, yielding 128522 as the result.
Example #3
CODE("Hello")
Here, the function extracts the Unicode value of the first character “H”, which is 72.
Error handling
- VALUE! This error occurs if the input is not a valid text string. Ensure the argument is formatted correctly as text.
- N/A This message appears if the string provided is empty. Ensure that you provide a non-empty string.