UNICODE Function

Excel Functions › Text

Excel 2013+ Text

The Excel UNICODE function returns the Unicode code point of the first character of a text string — the number that tells you what a character really is. That makes it the forensic tool for imported data: the “space” that breaks your lookups turns out to be character 160, the “dash” is an en dash 8211, the “quote” is a curly 8220. It is the modern, full-Unicode replacement for CODE and the mirror image of UNICHAR. Available in Excel 2013 and later.


Quick answer: to find the code point of the first character in A2:
=UNICODE(A2)
=UNICODE("A") returns 65; =UNICODE("™") returns 8482. Only the first character is examined — use MID to inspect others.

Syntax

=UNICODE(text)
ArgumentDescription
textRequiredThe text whose first character you want the code point of. Empty text "" returns #VALUE!.

Available in: Excel 2013 and later, Excel for Microsoft 365, and Excel for the web. Older versions show #NAME? — the legacy CODE function exists everywhere but only answers correctly for characters 1–255.

Identify any character

Point UNICODE at a character and it names the number. The boring rows are sanity checks; the interesting rows are the troublemakers that look like something else:

AB
1Character=UNICODE(A2)
2A65
38482
48226
5(non-breaking space)160
6– (en dash)8211
=UNICODE(A2) // first character of A2

To inspect a character in the middle of a string, slice it out with MID first:

=UNICODE(MID(A2, 5, 1)) // code point of the 5th character

Try it: interactive UNICODE demo

Live demo

Type or paste any character — UNICODE reports the code point of the first one. Paste a mystery character from your own data to unmask it.

Debug the invisible: why your lookups fail

Two cells look identical, yet =A2=B2 says FALSE and VLOOKUP finds nothing. UNICODE settles the argument. Walk the string character by character — in Excel 365 one spilling formula maps every code point:

=UNICODE(MID(A2, SEQUENCE(LEN(A2)), 1)) // spills the code of every character in A2

The usual suspects this exposes:

Looks likeActually isCode
a spacenon-breaking space (web imports)160
a spacezero-width space8203
a hyphen -en dash or em dash8211 / 8212
a quote "curly quotes from Word8220 / 8221
the letter ACyrillic A1040

Once identified, swap the offender out with SUBSTITUTE + UNICHAR:

=SUBSTITUTE(A2, UNICHAR(160), " ") // replace non-breaking spaces, then TRIM

Errors & common pitfalls

#VALUE! — empty text. =UNICODE("") has no first character to report. Guard with =IF(A2="", "", UNICODE(A2)) when the column has blanks.

#NAME? — Excel 2010 or earlier. UNICODE arrived in Excel 2013. The legacy CODE works there, but reports a misleading answer (often 63, a question mark) for anything outside its 255-character range.

Pitfall: only the first character counts. =UNICODE("Dallas") returns 68 — the D — and says nothing about the rest. Use MID (or the SEQUENCE recipe above) to scan a whole string.

Pitfall: numbers get converted to text first. Point UNICODE at the number 742 and it sees the string “742”, returning 55 for the digit 7 — not an error, just probably not what you meant.

Practice workbook

📊
Download the free UNICODE practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between UNICODE and CODE?
CODE is the legacy function: reliable only for characters 1–255 and dependent on your system code page. UNICODE (Excel 2013+) returns the true code point for any character. Use UNICODE unless you must support Excel 2010.
How do I find an invisible character that's breaking my VLOOKUP?
Compare lengths first: =LEN(A2) vs what you see. Then scan: =UNICODE(MID(A2,SEQUENCE(LEN(A2)),1)) spills every code point. A 160 means non-breaking space — remove it with =SUBSTITUTE(A2,UNICHAR(160)," ") and TRIM.
Does UNICODE look at the whole string or just one character?
Just the first character. =UNICODE("Dallas") returns 68, the code for D. To inspect position 5, wrap MID: =UNICODE(MID(A2,5,1)).
Are UNICODE and UNICHAR opposites?
Yes — =UNICHAR(UNICODE(A2)) returns A2’s first character unchanged. UNICODE goes character → number; UNICHAR goes number → character.
Why do UNICODE and CODE give different answers for the same character?
For characters above 127, CODE answers from your system's legacy code page (and returns 63 for anything it can't map); UNICODE answers from the universal Unicode standard. UNICODE's answer is the portable, correct one.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: UNICHAR · CODE · CHAR · MID · SUBSTITUTE · TRIM