Excel Function: UNICODE

Purpose

The UNICODE function translates the first character in a text value into the number that it corresponds to in the unicode system.

Invocations of the UNICODE function take the form:

UNICODE(text)

Arguments

ArgumentArgument typeDescription
textMandatoryA text value whose first character will be examined and its unicode number returned.

Related Functions

FunctionExamplePurpose
UNICHARUNICODE(UNICHAR(number))Returns the character corresponding to a unicode number.

Error Conditions

Error valueCondition typeCondition
#VALUE!Bad argumentA value of type currency, geography, or stock was supplied to the text argument.

Examples

ExampleFormulaResultDescription
1=UNICODE("a")97Applying the UNICODE function to a single character returns its unicode number.
2=UNICODE("ab")97Applying the UNICODE function to text returns the unicode number of the first character.
3=UNICODE(DATE(2023,5,7))52The date May 7, 2023 is stored as 45053. The unicode number of “4” was returned.
4=UNICODE(TIME(12,00,00))48The time 12:00:00 is stored as 0.5. The unicode number of “0” was returned.
5=UNICODE(1)49Applying the UNICODE function to a single digit number returns its unicode number.
6=UNICODE(12)49Applying the UNICODE function to a number returns the unicode number of its first digit.

Examples: Errors

Example‘Text’ argumentResultDescription
1MICROSOFT CORPORATION (XNAS:MSFT)#VALUE!Supplying a stock value to the UNICODE function’s text argument causes an error.
2USD/EUR#VALUE!Supplying a currency value to the UNICODE function’s text argument causes an error.
3Stamford#VALUE!Supplying a geography value to the UNICODE function’s text argument causes an error.

These errors can be mitigated by converting values of type stock, currency and geography to text before passing them to the UNICODE function. I.e.:

UNICODE(VALUETOTEXT(text,0))