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)| Argument | What it means | |
|---|---|---|
text | Required | The 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
| A | B | |
|---|---|---|
| 1 | Symbol | |
| 2 | € | 8364 |
Result: 8364
The euro sign is code point 8364 (U+20AC).
2Spot a lookalike character
| A | B | |
|---|---|---|
| 1 | Customer name | |
| 2 | O’Brien | 8217 |
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
| A | B | |
|---|---|---|
| 1 | Word | |
| 2 | Ωmega | 937 |
Result: 937
The Greek capital omega is code point 937; the remaining letters are ignored.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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.