UNICHAR function

UNICHAR(CodePoint) UNICHAR(CodePoint)

CodePoint

Number or { Number }

A Unicode code point.

Returns

Text or { Text }

A single text character.

Returns a single text character, identified by a Unicode code point. UNICHAR(65)UNICHAR(65) returns "A".

The code points 1 through 128 are identical to a standard named ASCII, which has been in use since the 1960s. If you have memorized character codes that have worked with spreadsheet software for decades, these will most likely work with this function.

There is a complete list of all 95 printable characters and their ASCII character codes at Wikipedia, which may be used with this function. (Use the values from the Dec column.)

Unlike the CHAR function, UNICHAR supports the entirety of Unicode. UNICHAR(HEX2DEC("1F602"))UNICHAR(HEX2DEC("1F602")), for instance, returns the emoji 😂.

Use CODE or UNICODE to perform the reverse operation of returning a character corresponding to a certain Unicode code point.

Retrieving all the letters of the English alphabet

This function may be used in conjunction with other functions to quickly retrieve, say, an array of all upper-case letters of the (English) alphabet:

UNICHAR(SEQUENCE(26, 65))UNICHAR(SEQUENCE(26; 65))

SEQUENCE returns an array of size 26, starting at 65 ({ 65, 66, 67, ... }{ 65; 66; 67; ... }), with one array element per letter. When UNICHAR is given an array, it is invoked once for every array element, and the results are collected together in an array. As such, UNICHAR(SEQUENCE(26, 65))UNICHAR(SEQUENCE(26; 65)) returns the array { "A", "B", "C", ... }{ "A"; "B"; "C"; ... }.

To convert this array of upper-case letters to a single text string, use the TEXTJOIN function:

TEXTJOIN("", FALSE, UNICHAR(SEQUENCE(26, 65)))TEXTJOIN(""; FALSE; UNICHAR(SEQUENCE(26; 65)))

This formula returns the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ".

The first parameter, "", specifies the delimiter between array elements. As nothing should separate the array elements, "" is used. The second parameter, FALSE, instructs TEXTJOIN not to ignore empty elements (though there are none).

Examples

UNICHAR(65)UNICHAR(65)

Returns "A".

UNICHAR(HEX2DEC("1F602"))UNICHAR(HEX2DEC("1F602"))

Returns "😂". Unicode code points are typically written as hexadecimal strings (base 16), which can be converted to decimal numbers (base 10) using the HEX2DEC function. The emoji 😂 has the code point 1F602.

UNICHAR(SEQUENCE(26, 65))UNICHAR(SEQUENCE(26; 65))

Returns an array of all the upper-case letters of the English alphabet, { "A", "B", "C", ... }{ "A"; "B"; "C"; ... }. SEQUENCE returns an array of size 26, starting at 65 ({ 65, 66, 67, ... }{ 65; 66; 67; ... }). When UNICHAR is given an array, it is invoked once for every array element, and the results are collected together in an array.

TEXTJOIN("", FALSE, UNICHAR(SEQUENCE(26, 65)))TEXTJOIN(""; FALSE; UNICHAR(SEQUENCE(26; 65)))

Returns a text string containing all the upper-case letters of the English alphabet, "ABC...". SEQUENCE returns an array of size 26, starting at 65 ({ 65, 66, 67, ... }{ 65; 66; 67; ... }). When UNICHAR is given an array, it is invoked once for every array element, and the results are collected together in an array. TEXTJOIN then joins these array elements together in a single text string (where the first parameter, "", specifies that no delimiter between the array elements should be used).