The UNICHAR function in Excel returns a Unicode character from a given number. Unicode is a standard that assigns a unique code to every character in any language or writing system. For example, the Unicode number for the letter A is 65, and the Unicode number for the smiley face emoji is 128512.
The UNICHAR function can be useful for inserting special symbols, emojis, or foreign characters in your Excel worksheets. You can also use it to create custom formats, charts, or graphics with Unicode characters.
Syntax and Arguments
The syntax of the UNICHAR function is:
=UNICHAR(number)
The only argument is:
number
– The Unicode number of the character you want to return. It can be a positive integer between 1 and 1114111, or a cell reference that contains such a number.
Examples and Explanation
Let’s see some examples of how to use the UNICHAR function in Excel.
Example 1: Inserting a Symbol
Suppose you want to insert the symbol for pi (π) in your worksheet. You can use the UNICHAR function with the Unicode number 960, which is the code for the Greek letter pi. Enter the following formula in a cell:
=UNICHAR(960)
The result is:
π
You can also use a cell reference that contains the Unicode number, such as A1. For example, if A1 has the value 960, you can enter the formula:
=UNICHAR(A1)
The result is the same as above.
Example 2: Inserting an Emoji
Suppose you want to insert the emoji for a red heart (❤️) in your worksheet. You can use the UNICHAR function with the Unicode number 10084, which is the code for the heavy black heart symbol. Enter the following formula in a cell:
=UNICHAR(10084)
The result is:
❤
However, this is not the same as the red heart emoji, which has a different Unicode number. To get the red heart emoji, you need to use the UNICHAR function with the Unicode number 128150, which is the code for the heavy heart exclamation mark ornament. Enter the following formula in a cell:
=UNICHAR(128150)
The result is:
❤️
Note that some emojis may not display correctly in Excel, depending on the font and the operating system you are using. You can check the Unicode Emoji List to find the Unicode numbers for different emojis.
Example 3: Creating a Custom Format
Suppose you want to create a custom format for a cell that shows the percentage with a star symbol (★) after the number. You can use the UNICHAR function with the Unicode number 9733, which is the code for the black star symbol. To create the custom format, follow these steps:
- Select the cell or range of cells that you want to format.
- Right-click and choose Format Cells from the context menu.
- In the Format Cells dialog box, go to the Number tab and select Custom from the Category list.
- In the Type box, enter the following formula:
0.00%\ UNICHAR(9733)
- Click OK to apply the format.
The result is that the cell or range of cells will show the percentage with a star symbol after the number. For example, if the cell value is 0.75, the formatted value will be:
75.00% ★
You can use any Unicode character that you want in the custom format, as long as you use the UNICHAR function with the correct Unicode number.
Other Approaches
There are some other ways to insert Unicode characters in Excel, besides using the UNICHAR function. Here are some of them:
- You can use the Insert Symbol dialog box to insert any symbol or character that is available in the fonts installed on your computer. To access the Insert Symbol dialog box, go to the Insert tab on the ribbon, and click on Symbol in the Symbols group. You can then choose the font, the subset, and the symbol that you want to insert.
- You can use the CHAR function to insert characters from the ASCII or ANSI character set, which are subsets of the Unicode character set. The CHAR function takes a number between 1 and 255 as an argument, and returns the corresponding character. For example, the formula
=CHAR(65)
returns the letter A, and the formula=CHAR(169)
returns the copyright symbol (©). - You can use the keyboard shortcuts to insert some common symbols or characters. For example, you can press Alt + 227 to insert the symbol for pi (π), or Alt + 3 to insert the symbol for a heart (♥). You can find more keyboard shortcuts for symbols and characters here.