To insert a specific character in Excel using its numeric code, use the =CHAR(number) function. This allows you to add symbols, line breaks, or characters that are not available on a standard keyboard by referencing the character set installed on your computer.
The CHAR function is primarily used to clean data, format text for reports, or insert "invisible" characters like carriage returns. Because Excel uses the Windows ANSI character set (and Unicode in some versions), the number you enter corresponds to a specific symbol in that library.
What You'll Need
- Microsoft Excel (any version).
- The numeric character code for the symbol you wish to insert (e.g., 10 for a line break, 34 for a double quote).
Step-by-Step
- Identify the Character Code: Determine the numeric code for the character you need. For example, if you want to insert a line break within a cell, the code is 10. If you want a degree symbol, the code is 176.
- Select the Target Cell: Click on the cell where you want the character to appear, or select a cell where you will build a formula that combines text and a character.
- Enter the Basic Formula: Type
=CHAR(followed by the numeric code and a closing parenthesis.- Example:
=CHAR(176)will display the degree symbol (°).
- Example:
- Combine with Other Text (Concatenation): Most often, you will want to combine a character with existing text. Use the ampersand (
&) symbol to join them.- Example: To combine a name in cell A1 with a degree symbol, type:
=A1 & CHAR(176).
- Example: To combine a name in cell A1 with a degree symbol, type:
- Inserting a Line Break: To force text to start on a new line within a single cell, use
CHAR(10).- Example:
="First Line" & CHAR(10) & "Second Line".
- Example:
- Enable Wrap Text: If you used
CHAR(10)for a line break, the cell may still look like a single line. You must enable Wrap Text for the break to be visible.- Go to the Home tab.
- In the Alignment group, click Wrap Text.
- Press Enter: Once the formula is complete, press Enter to render the character.
Common Mistakes
- Forgetting Wrap Text: The most common error when using
CHAR(10)is forgetting to turn on Wrap Text. Without this setting, Excel ignores the line break and displays the text on one line. - Using the Wrong Code: Using a code that doesn't exist or is outside the supported range for your system's character set will result in a
#VALUE!error. - Incorrect Concatenation: Forgetting the ampersand (
&) when joining a CHAR function to a text string will cause a formula error. - Confusing CHAR with CODE: The
CHARfunction converts a number to a character. TheCODEfunction does the opposite—it takes a character and tells you its numeric code.
Tips
- Create a Reference Table: If you frequently use symbols like checkmarks, bullets, or currency signs, create a small table in a hidden sheet with the code in one column and the resulting character in the next for quick copying.
- Clean Data with SUBSTITUTE: You can use
SUBSTITUTEalongsideCHARto remove unwanted characters. For example, to remove all line breaks from a cell, use=SUBSTITUTE(A1, CHAR(10), " ")to replace the break with a space. - Double Quotes: To put a double quote inside a formula string without causing a syntax error, use
CHAR(34). Example:="He said " & CHAR(34) & "Hello" & CHAR(34).
Troubleshooting
If the formula does not produce the expected result, try these steps in order:
- Check for #VALUE! Errors: Ensure the number inside the parentheses is a whole number between 1 and 255. If you enter a number outside this range, Excel cannot find the character.
- Verify Wrap Text: If you are trying to create a new line and it isn't working, double-check that Home > Wrap Text is highlighted.
- Check Your Region/Language: Some character codes vary slightly depending on the system's language settings (ANSI vs. UTF-8). If a symbol looks wrong, search for the specific "ANSI character code" for your region.
- Review Formula Syntax: Ensure all quotation marks are closed and all ampersands are placed correctly between the text strings and the
CHAR()function.
Frequently Asked Questions
What is the code for a line break in Excel?
The code for a line break (carriage return) is 10. Use =CHAR(10) and ensure "Wrap Text" is enabled for the cell.
How do I find the char code for a symbol I already have?
Use the CODE function. If the symbol is in cell A1, type =CODE(A1), and Excel will return the numeric value of that character.
Can I use CHAR codes for emojis?
Standard CHAR() functions in older versions of Excel only support the basic ANSI set (up to 255). For emojis and complex Unicode characters, you generally need to use the UNICHAR() function, which supports much larger numeric values.
Why does my CHAR(10) formula just show the formula text instead of the result?
This happens if the cell is formatted as "Text" instead of "General." Change the cell format to General, then click into the formula bar and press Enter again.
How do I insert a double quote using a char code?
Use CHAR(34). This is the most reliable way to include quotes within a formula without confusing Excel's syntax.