Example 1
Join two cells with a line break
C2 =A2&CHAR(10)&B2
Result: Dana Whitfield Finance
CHAR(10) is a line break. Turn on Wrap Text for C2 to see the two lines.
C2 =A2&CHAR(10)&B2 returns Dana Whitfield
Finance
Returns the character for a number code from 1 to 255, such as a line break, a quotation mark or a letter.
Syntax
=CHAR()
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =A2&CHAR(10)&B2 returns Dana Whitfield
Finance
CHAR returns the character that matches a number code. In practice it is used for two things: typing characters that are awkward to put in a formula, such as a line break or a double quotation mark, and building letters from numbers.
Codes 1 to 127 are the same on Windows and Mac:
| Code | Character | |---|---| | 9 | Tab | | 10 | Line break (line feed) | | 13 | Carriage return | | 32 | Space | | 34 | Double quotation mark | | 65 to 90 | A to Z | | 97 to 122 | a to z | | 48 to 57 | 0 to 9 |
=A2&CHAR(10)&B2 joins two cells with a line break between them. The break only shows once the cell has Wrap Text turned on. Without it, you see both values on one line. TEXTJOIN with CHAR(10) as the delimiter builds a multi-line list. To take line breaks out of imported text, replace them: =SUBSTITUTE(A2,CHAR(10)," ").
A double quotation mark is awkward to type inside a formula's text, because quotes end the text. CHAR(34) supplies one: =CHAR(34)&A2&CHAR(34) wraps the value of A2 in quotes. You can also double the quotes inside the string: =""""&A2&"""" returns the same result, but is hard to read.
Letters run in order from 65. =CHAR(64+3) returns C, the third letter. That is how to turn a column number into a column letter for up to 26 columns, or number a list A, B, C.
Codes 128 to 255 depend on the character set of the computer. Windows and Mac assign them to different symbols, so a workbook that uses CHAR(169) can show a different symbol, or none, on another machine. When you need a symbol outside the basic set, use UNICHAR, which uses Unicode and gives the same character everywhere.
CHAR accepts one number and returns one character. It doesn't accept 0 or numbers over 255, which return #VALUE!. It also can't build multi-character text on its own. It is the reverse of CODE, which returns the number for a character: =CODE(CHAR(65)) returns 65.
In Microsoft 365 you can pass CHAR an array of numbers, which makes a sequence of characters. =CHAR(SEQUENCE(5,1,65)) returns A to E down a column.
10 is a line break, 34 is a double quotation mark, 65 is "A". Other values return #VALUE!.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =A2&CHAR(10)&B2
Result: Dana Whitfield Finance
CHAR(10) is a line break. Turn on Wrap Text for C2 to see the two lines.
C2 =A2&CHAR(10)&B2 returns Dana Whitfield
Finance
Example 2
C2 =CHAR(34)&A2&CHAR(34)
Result: "Nitrile gloves"
CHAR(34) is the double quotation mark. It saves you from escaping quotes inside the formula.
C2 =CHAR(34)&A2&CHAR(34) returns "Nitrile gloves"
Example 3
C2 =CHAR(64+A2)
Result: C
Letter A is code 65, so 64 plus the position gives the matching letter. A position of 3 returns C.
C2 =CHAR(64+A2) returns C
Example 4
C2 =B2&": "&CHAR(34)&A2&CHAR(34)
Result: Survey: "Faster than before"
The comment is placed inside quotation marks without any escaping in the formula.
C2 =B2&": "&CHAR(34)&A2&CHAR(34) returns Survey: "Faster than before"
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B2, turn the position in A2 into a letter, so 1 gives A and 2 gives B. Fill it down to B5.
Answer in B2, then it fills down to B5.
CHAR(0) and CHAR(256) both return #VALUE!.CHAR(10).CHAR(53) is the text "5", not the number 5.Use `CHAR(10)`: `=A2&CHAR(10)&B2`. Turn on Wrap Text in the cell, or the break won't show.
Use `CHAR(34)`, as in `=CHAR(34)&A2&CHAR(34)`. You can also double the quotes inside the text: `=""""&A2&""""`.
Add the number to 64 and pass it to CHAR: `=CHAR(64+A2)` returns A for 1, B for 2 and so on up to Z for 26. For lower case, use 96 instead of 64.
CHAR uses the 1 to 255 character set of your computer. UNICHAR uses Unicode, so it covers symbols and other alphabets and returns the same character on any computer.
CODE. `=CODE("A")` returns 65 and `=CHAR(65)` returns "A".
CHAR is taught in Logic and text, lesson 9: SUBSTITUTE. Each lesson is a short, graded exercise like the one above.