Excel UNICODE Function: Syntax, Examples and Tips

Part of the free Module 5: Excel Formulas and Functions · Function 93 of 102 · Full Excel course

The Excel UNICODE function returns the Unicode code point of the first character in a text string as a decimal number. It is the reverse of UNICHAR and the modern replacement for CODE: where CODE is limited to the 255 characters of the local code page, UNICODE identifies any character from any language, symbol set or emoji. It is available in Excel 2013 and later.

Syntax

=UNICODE(text)

Arguments

Argument Required / Optional Meaning
text Required The text whose first character you want to identify. Only the first character is read. An empty string returns #VALUE!.

How UNICODE works

UNICODE looks at the first character and returns its code point. For the basic Latin range the numbers match CODE: =UNICODE("A") returns 65 and =UNICODE("a") returns 97. Beyond that range the two diverge. =UNICODE("€") returns 8364, =UNICODE("α") returns 945 and =UNICODE("😀") returns 128512. Numbers are converted to text first, so =UNICODE(7) returns 55, the code for the digit 7. If the text begins with an invalid partial surrogate, the function returns #N/A.

Step-by-step example: identify a mystery character

  1. A column of product names imported from a supplier contains entries that look correct but fail an exact match. Cell A2 appears to read “Café Table”.
  2. In B2 enter =UNICODE(MID(A2,4,1)). It returns 233 for a normal é.
  3. Copy the formula for the row that fails. It returns 101 (a plain e) because the source stored the accent as a separate combining character, so the word actually has one more character than it appears to.
  4. Fix the data with =SUBSTITUTE(A2,UNICHAR(101)&UNICHAR(769),UNICHAR(233)), which replaces the two-character sequence with the single accented letter, and the matches succeed.

Practical use cases

1. List the code point of every character in a cell

=UNICODE(MID($A$2,ROW(A1),1))

Fill down to expose hidden characters such as 8203 (zero-width space) or 65279 (byte order mark).

2. Detect non-ASCII characters

=SUMPRODUCT(--(UNICODE(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))>127))>0

Returns TRUE if any character lies outside the ASCII range, which flags entries that may break an export.

3. Sort by script

=IF(UNICODE(A2)>=1024,"Cyrillic",IF(UNICODE(A2)>=913,"Greek","Latin"))

4. Find the code for a symbol you want to reuse

=UNICODE("✓")

Paste the symbol once, read the number (10003) and use UNICHAR(10003) in your formulas.

Common mistakes and tips

  • #VALUE! on blank cells: UNICODE cannot evaluate an empty string. Wrap it in IF(A2=””,””,UNICODE(A2)).
  • Only the first character: use MID to inspect later positions.
  • Emoji return the full code point: although LEN counts an emoji as 2, UNICODE correctly returns the single code point such as 128512.
  • #NAME? error: the workbook is open in Excel 2010 or earlier, which lacks UNICODE. CODE is the only option there.
  • Hex references: Unicode tables show U+2713. Convert with DEC2HEX(UNICODE(A2)) to compare against them.

UNICODE compared with CODE

Both functions return a number for the first character, and for plain English text they agree. CODE depends on the operating system’s code page: Windows-1252 on most Windows PCs and Mac Roman on older Macs, so codes 128 to 255 can differ by platform, and any character outside the code page is reported as 63, the question mark. UNICODE has no such limits and returns the same value on Windows, Mac and Excel for the web. For new workbooks there is no reason to prefer CODE unless compatibility with Excel 2010 is required. The pair UNICODE and UNICHAR lets you round-trip any character: read its number with UNICODE, store or transform the number, and rebuild the character with UNICHAR.

Related functions

  • UNICHAR: converts a code point back to a character.
  • CODE: the 8-bit predecessor limited to the local code page.
  • MID: extracts the character you want to inspect.
  • CLEAN: removes control characters that UNICODE reveals.
  • See all lessons in the Excel Formulas course.

Frequently asked questions

What is the difference between UNICODE and CODE in Excel?

CODE returns a number from the local 8-bit code page and can differ between Windows and Mac. UNICODE returns the Unicode code point, which is the same everywhere and covers every language and symbol.

How do I find the Unicode value of a character in Excel?

Type or paste the character into a cell and use =UNICODE(A2). For a character later in a string, use =UNICODE(MID(A2,n,1)).

Why does UNICODE return #VALUE!?

The text argument is an empty string, usually because the referenced cell is blank.

Need a ready-made template? Browse 7,000+ Excel, Power BI and Google Sheets templates at NextGenTemplates.com.