The UNICODE function in Excel returns the numeric Unicode value of the first character in a text string. Unicode is a standard encoding system that assigns a unique number to every character in any language. For example, the Unicode value of the letter A is 65, and the Unicode value of the symbol @ is 64.
The syntax of the UNICODE function is:
=UNICODE(text)
where text is the text string or cell reference that contains the character you want to get the Unicode value of.
Steps
To use the UNICODE function in Excel, follow these steps:
- Select a cell where you want to enter the formula.
- Type
=UNICODE(
and then select the cell or type the text that contains the character you want to get the Unicode value of. For example,=UNICODE(A2)
or=UNICODE("Hello")
. - Press Enter to complete the formula. The result will be the numeric Unicode value of the first character in the text string. For example,
=UNICODE(A2)
will return 72 if cell A2 contains the word “Hello”, because the Unicode value of H is 72. - To get the Unicode values of other characters in the text string, you can use the MID function to extract each character and then apply the UNICODE function to it. For example,
=UNICODE(MID(A2,2,1))
will return 101, which is the Unicode value of e, the second character in “Hello”.
Example
Let’s say you have a list of names in column A, and you want to get the Unicode values of the first letters of each name. You can use the following formula in column B:
=UNICODE(A2)
This will return the Unicode value of the first character in cell A2. You can then drag the formula down to fill the rest of the column. The result will look something like this:
Name | Unicode |
---|---|
Alice | 65 |
Bob | 66 |
Carol | 67 |
David | 68 |
Eve | 69 |
Other Approaches
There are other ways to get the Unicode values of characters in Excel, such as:
- Using the CODE function, which returns the ASCII value of the first character in a text string. ASCII is a subset of Unicode that covers the basic Latin characters and symbols. For example,
=CODE(A2)
will return the same result as=UNICODE(A2)
for the names in the example above, but it will not work for characters that are not in the ASCII range, such as accented letters or emojis. - Using the CHAR function, which returns the character that corresponds to a given Unicode value. For example,
=CHAR(65)
will return A, and=CHAR(128512)
will return 😀. You can use this function to convert Unicode values back to characters, or to insert special characters that are not on your keyboard. - Using the UNICHAR function, which is similar to the CHAR function, but works for all Unicode characters, not just the ASCII range. For example,
=UNICHAR(65)
will return A, and=UNICHAR(128512)
will return 😀. You can use this function to insert any Unicode character in Excel.