CHAR function

CHAR(CodePoint) CHAR(CodePoint)

CodePoint

Number or { Number }

A Unicode code point between 1 and 255 (inclusive). Use the UNICHAR function to get access to more code points.

Returns

Text or { Text }

A single text character.

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

This function only accepts code points 1 through 255 — use UNICHAR to access the entirety of Unicode.

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.)

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:

CHAR(SEQUENCE(26, 65))CHAR(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 CHAR is given an array, it is invoked once for every array element, and the results are collected together in an array. As such, CHAR(SEQUENCE(26, 65))CHAR(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, CHAR(SEQUENCE(26, 65)))TEXTJOIN(""; FALSE; CHAR(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

CHAR(65)CHAR(65)

Returns "A".

"A" & CHAR(10) & "B""A" & CHAR(10) & "B"

Returns "A", followed by a line break character, followed by "B". CHAR(10)CHAR(10) and NEWLINE()NEWLINE() are equivalent.

CHAR({ 65, 66, 67 })CHAR({ 65; 66; 67 })

Returns the array { "A", "B", "C" }{ "A"; "B"; "C" }.

CHAR(SEQUENCE(26, 65))CHAR(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 CHAR is given an array, it is invoked once for every array element, and the results are collected together in an array.

TEXTJOIN("", FALSE, CHAR(SEQUENCE(26, 65)))TEXTJOIN(""; FALSE; CHAR(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 CHAR 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).