Text function

UNICODE function

Returns the Unicode code point of the first character of a text, e.g. UNICODE("€") = 8364.

Available in Excel 2013 and later, Microsoft 365, Excel for the web

Excel 2013 and laterWorks in Google Sheets

Syntax

UNICODE(text)
ArgumentWhat it means
textRequiredThe text whose first character you want to identify.

Returns: A number: the Unicode code point.

How UNICODE works

UNICODE is the reverse of UNICHAR and the Unicode-aware version of CODE. It looks at the first character of a text and returns its number in the Unicode standard. Unlike CODE, it gives the right answer for every character in every language: Ω returns 937, € 8364, 東 26481.

It is the best tool for investigating characters that look normal but behave strangely: a non-breaking space (160) instead of a normal space (32), a full-width letter (65,313 for A instead of 65), a curly apostrophe (8217) instead of a straight one (39), or an en dash (8211) instead of a hyphen (45). Once you know the number, SUBSTITUTE with UNICHAR removes or replaces the culprit.

Examples

1Code of a currency symbol

B2fx=UNICODE(A2)
AB
1Symbol
2€8364

Result: 8364

The euro sign is code point 8364 (U+20AC).

2Spot a lookalike character

B2fx=UNICODE(MID(A2,2,1))
AB
1Customer name
2O’Brien8217

Result: 8217

The apostrophe is the curly one (8217), not the straight ' (39). That is why a lookup for O'Brien fails; fix it with SUBSTITUTE(A2,UNICHAR(8217),"'").

3Only the first character counts

B2fx=UNICODE(A2)
AB
1Word
2Ωmega937

Result: 937

The Greek capital omega is code point 937; the remaining letters are ignored.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!The text is empty.Wrap it: =IF(A2="","",UNICODE(A2)).

Tips

  • See the code of every character (Microsoft 365): =UNICODE(MID(A2,SEQUENCE(LEN(A2)),1)).
  • Convert the result to the familiar U+ form with ="U+"&DEC2HEX(UNICODE(A2),4).

Google Sheets

UNICODE also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.