Function Reference: CODE, UNICODE
| Syntax | ||
| =CODE(text) =UNICODE(text) |
||
| Purpose / Description | ||
| Returns the character code of the first character in the text string provided. CODE can only be used safely with characters from the ASCII character set, UNICODE will work with all characters that can be used in the Extended Character set Windows or MacOS. | ||
| Arguments | ||
| Name | Type | Description |
| text | text string | A constant, reference or nested expression that returns the text string, the first character of which is to be returned as a character code. |
| Return Values | ||
| Type | Specific Value | Description |
| number | The character code in the ASCII character set (CHAR) or the character code from the Unicode character set (UNICODE) of the first character in the text argument. | |
| number | 63 | If the first character in the text argument has a code above 255 (which is outside the ASCII range of character codes), the CODE function returns this value. |
| error | #VALUE! | If the text argument is a blank cell. |
| error | Any errors referenced by arguments are returned due to propagation of error values. | |
| Notes / Comments / Advice / Warnings | ||
| Advice: | As a general rule, we recommend the use of UNICODE as the default to avoid issues with text, especially that sourced from the web. | |
| Useful Links: | About ASCII (Wikipedia article) Clean ASCII Character Code Table Unicode Character Table (Wikipedia article) |
|
| Examples: | Open / download sample workbook: CHAR, UNICHAR, CODE, UNICODE.xlsx | |