How to use the UNICHAR function
What is the UNICHAR function?
The UNICHAR function in Excel returns the Unicode character corresponding to a given Unicode code point number.
What is UNICODE?
Unicode provides a universal character set and encoding schemes to represent text consistently across computing technologies and interfaces. It supports internationalization and localization needs which enables global websites and apps to display text and accept input in any language script like Arabic, Chinese, Hindi etc. without restrictions.
- Provides a unique number for every character, regardless of the platform, device, application, or language.
- With the capacity to represent over 1.1 million characters, Unicode encompasses all the world's languages and writing systems in one unified encoding standard.
- Allows data exchange and processing of text in any language combination.
- Maintained by the Unicode Consortium and coordinated with ISO standards.
- Common Unicode encodings are UTF-8, UTF-16, and UTF-32, which provide variable length or fixed width representations.
What is a character set?
A character set is a defined collection of textual characters used to represent writing systems, symbols, and numbers. They provide a mapping between numeric codes and human-readable characters. Common character sets include ASCII, Unicode, UTF-8, Latin-1, etc.
What is the difference between the UNICHAR function and the CHAR function?
UNICHAR takes a Unicode code point as input and returns the Unicode character for that code point. CHAR takes an ANSI code value as input and returns the ANSI character (windows).
What is the difference between UNICODE and ANSI?
ANSI uses 8-bit encoding, unicode uses variable width encoding of 8-bit to 32-bit. ANSI is limited to English, unicode enables internationalization and localization. ANSI predates Unicode and is a legacy standard, Unicode is a newer standard.
The UNICHAR and the UNICODE functions let you convert between Unicode characters and their underlying code point representations.
Table of Contents
1. UNICHAR Function Syntax
UNICHAR(number)
2. UNICHAR Function Arguments
number | Required. The Unicode number for which you want the corresponding character. |
3. UNICHAR Function example
UNICHAR function converts a Unicode code point value to its corresponding Unicode character.
Formula in cell C4:
The UNICHAR function accepts a numeric Unicode code point which is 65 in this example. For code point 65, the corresponding Unicode character is 'A'. UNICHAR(65) evaluates to 'A'.
4. UNICHAR Function not working
The UNICHAR function returns:
- #N/A error value if data type is not valid.
- #VALUE! error
- if number is 0 (zero).
- if outside the range.
5. How to convert from formal Unicode notation U+XXXX to its corresponding Unicode character
The following formula converts a hexadecimal unicode to the matching unicode character.
Explaining formula
Step 1 - Remove two first characters from string (U+)
The MID function returns a substring from a string based on the starting position and the number of characters you want to extract.
Function syntax: MID(text, start_num, num_chars)
MID(B3,3,99)
becomes
MID("U+0045",3,99)
and returns "0045".
Step 2 - Convert hexadecimal to decimal
The HEX2DEC function converts a hexadecimal number to a decimal number.
Function syntax: HEX2DEC(number)
HEX2DEC(MID(B3,3,99))
becomes
HEX2DEC("0045")
and returns 69.
Step 3 - Convert unicode to character
The UNICHAR function calculates a character based on a Unicode number.
Function syntax:
UNICHAR(HEX2DEC(MID(B3,3,99)))
becomes
UNICHAR(69)
and returns "E".
Useful links
UNICHAR function - Microsoft support
UNICODE - wikipedia
Functions in 'Text' category
The UNICHAR function function is one of many functions in the 'Text' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form