In Excel for Microsoft 365, use CHAR(number) to return the character assigned to a numeric code, such as CHAR(65) for A or CHAR(10) for a line break. It is especially useful for adding separators or new lines inside formulas; the examples below show the required cell setup and the result each formula returns.
What the CHAR function does
CHAR takes one numeric argument and returns a character from the character set used by the computer. Its syntax is CHAR(number), where the number is generally an integer from 1 through 255. The familiar codes for basic English letters, digits, and punctuation are useful for building text, while some codes represent control characters that do not print visibly.
A control character can still affect what a cell displays or how text is arranged. For example, code 10 represents a line feed, which Excel can use to start a new line inside a cell. This is why CHAR examples are often about formatting text rather than showing a visible symbol by itself. For characters outside the computer’s supported character set, use UNICHAR instead; it is designed to return Unicode characters.
Basic CHAR examples
These simple examples can be entered in any blank cell. They need no source data, so the formula result is the same wherever you put them.
- With no cell references required, enter
=CHAR(65). The result isA. - With no cell references required, enter
=CHAR(97). The result isa. - With no cell references required, enter
=CHAR(36). The result is$. - With no cell references required, enter
=CHAR(45). The result is a hyphen-minus:-. - With no cell references required, enter
=CHAR(32). The result is a regular space, which may look like an empty cell when it is the only result.
The number is a character code, not a position in a word or a formatting instruction. For example, CHAR(65) returns a capital A; it does not convert a value to uppercase. To change letter case, use Excel’s text functions such as UPPER or LOWER.
Add a line break inside a cell
The most common practical use is joining text from different cells on separate lines. Put the first piece of text in A2 and the second in B2. With A2 containing North office and B2 containing Open weekdays, enter this formula in C2:
=A2&CHAR(10)&B2
The result in C2 contains North office on the first line and Open weekdays on the second. CHAR(10) inserts a line-feed character between the two values; the ampersands join the pieces of text. If the cell appears to show everything on one line, select C2 and choose Home > Wrap Text. You may also need to adjust the row height. The line break is still in the cell even if the current display does not make it obvious.
You can insert more than one break by adding another &CHAR(10)& between text pieces. For a complete example, put a product name in A2, a category in B2, and a price label in C2. In D2, enter =A2&CHAR(10)&B2&CHAR(10)&C2. The result displays those three values on separate lines, provided Wrap Text is enabled. This is useful for compact labels, printable summaries, and address-style output.
Join text with separators and punctuation
CHAR can add a delimiter without typing that character directly into a formula. Suppose A2 contains West and B2 contains Q2. With those values in place, enter this formula in C2:
=A2&CHAR(124)&B2
The result is West|Q2, because character code 124 represents the vertical bar. This pattern can help create compact labels or delimiter-separated text. It does not automatically create a properly escaped CSV file, however: values containing commas, quotes, or line breaks may require additional handling before they can be safely exported.
For a name, assume A2 contains Doe and B2 contains Jane. Enter this formula in C2:
=A2&CHAR(44)&" "&B2
The result is Doe, Jane. CHAR(44) supplies a comma, and the quoted space adds a gap before the first name. A comma could simply be typed into the formula, so CHAR is not essential here; the example shows that punctuation can be assembled from character codes when a formula is being built systematically.
Generate a sequence of letters
CHAR can turn a sequence of numbers into letters, which is useful for small labels or demonstrations. In a blank worksheet, enter this formula in B1 and fill it down through B26:
=CHAR(ROW(A1)+64)
The formula in B1 returns A, because ROW(A1) is 1 and 1 plus 64 is 65. When filled down to B2, the relative reference changes to A2, so the result is B. In B26, the calculation is 26 plus 64, or 90, which returns Z. This technique relies on the standard character codes for the English capital letters. It is a compact example, not a general-purpose alphabet tool for every writing system.
Replace line breaks in imported text
Copied or imported data can contain line breaks inside cells. If you want to turn those breaks into spaces, put the original text in A2. For example, if A2 contains West office, a line break, and then Open weekdays, enter this formula in B2:
=TRIM(SUBSTITUTE(A2,CHAR(10)," "))
The result is West office Open weekdays. SUBSTITUTE replaces each line feed with a regular space, and TRIM removes extra ordinary spaces at the beginning and end and reduces repeated ordinary spaces between words. TRIM does not remove every possible invisible character, so unusual imported data may need further cleaning.
If the unwanted character is a tab rather than a line break, CHAR(9) is commonly used to identify it. With tab-containing text in A2, enter =SUBSTITUTE(A2,CHAR(9)," ") in B2 to replace tabs with spaces. The result depends on A2’s contents: each tab becomes one space. When cleaning data, identify the actual character first where possible; replacing a line feed will not remove a tab, and the reverse is also true.
CHAR, UNICHAR, and related functions
Use CHAR for codes that work in the computer’s character set, especially common codes such as letters, spaces, and the line feed. Extended codes from 128 through 255 can display differently depending on the character set and environment, so do not assume every such number will produce the same symbol on every system. This matters when a workbook is shared between computers or used with text from other languages.
Use UNICHAR when you need a Unicode character, such as many symbols and characters beyond the basic Latin alphabet. It is generally a better fit for a specific Unicode symbol than relying on an extended CHAR code. Also note that CHAR and UNICHAR return characters; they do not apply font styling, number formats, or conditional formatting.
Two related functions work in the opposite direction. CODE returns the numeric code for the first character in a text value according to the relevant character set, while UNICODE returns the Unicode number for the first character. These can help investigate text that contains an unexpected character. For a character outside the range supported by CHAR, matching it with UNICHAR is usually the more dependable approach.
Common problems and fixes
- The formula returns #VALUE!: Check that the argument is a valid number in the supported range and that the formula’s parentheses are balanced. A value below 1 or above 255 is not a valid CHAR code.
- The formula appears as text: The cell may be formatted as Text, or the entry may begin with an apostrophe. Change the cell to General, then re-enter the formula so Excel evaluates it.
- The line break is not visible: Select the result cell and enable Home > Wrap Text. Increase the row height if necessary. CHAR(10) inserts a line feed, but the display still depends on cell layout.
- A symbol looks different on another computer: Extended CHAR codes depend on the character set. For a Unicode symbol, use UNICHAR and check that the selected font supports the character.
- The wrong invisible character remains: Data may contain a carriage return, tab, or another control character rather than CHAR(10). Test likely characters individually or use Excel’s Find and Replace to inspect the source carefully.
Frequently Asked Questions
What does CHAR(10) do in Excel?
CHAR(10) returns a line-feed character. When joined between text values, it creates a new line within the resulting cell. Enable Wrap Text to display that break clearly.
How do I insert a line break in an Excel formula?
Join the text before and after the break with &CHAR(10)&. For example, with text in A2 and B2, =A2&CHAR(10)&B2 places the two values on separate lines in the result cell.
What is the difference between CHAR and UNICHAR?
CHAR returns a character from the computer’s character set using a code from its supported range. UNICHAR returns a Unicode character and is the better choice for many symbols and international characters.
Why does CHAR(10) not show a symbol?
Code 10 is a control character for a line feed, not a printable mark. Its effect is a new line. If you need a visible symbol, use a suitable character code or UNICHAR value instead.
Can CHAR remove line breaks?
CHAR itself returns a character; it does not remove text. To replace line breaks, use SUBSTITUTE with CHAR(10), supplying the cell with the text and the replacement you want, such as a space.
Related
- How to Move Cells Down in Excel Without Overwriting Data
- How to Merge Cells in Excel: Steps and Safe Options
- Merge Day, Month, and Year in Excel
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel INDEX MATCH Examples and How to Use ThemIn Excel, INDEX MATCH looks up a value by finding its position with MATCH and returning the value…
- Excel How to Filter Columns: Steps and TipsTo filter columns in Excel for Microsoft 365 on Windows, select a cell in your data, choose Data…
- Different Labels in Word: How to Make Each Label UniqueTo create different labels on one sheet in Microsoft Word, start a label mail merge, connect a recipient…
- How to Copy Formulas in Excel to a New Workbook SafelyTo copy formulas into a new Excel workbook, open both workbooks, copy the formula cells in the source,…
- SUMIF Excel Cell Reference: Syntax, Examples, and FixesWith criteria in A2:A6 and amounts in C2:C6, enter =SUMIF(A2:A6,"North",C2:C6) to add the amounts for rows marked North;…
- Power Query Filter: How to Filter Rows in ExcelTo filter in Power Query, open the query in Power Query Editor, select the filter arrow in a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.