CHAR Function Examples – Excel & Google Sheets
In this Article
This tutorial demonstrates how to use the Excel CHAR Function in Excel to return a character.
CHAR Function Overview
The CHAR Function Returns a character specified by a code number referring to the character set on your computer.
To use the CHAR Excel Worksheet Function, select a cell and type:
(Notice how the formula inputs appear)
CHAR function Syntax and inputs:
number – The number representing the character you wish to return.
What Is the CHAR Function?
A “character set” is a list of all the text characters that your computer can display on your screen, whether that’s numbers, letters, symbols, or punctuation marks.
The character set also includes characters that your computer processes, but does not display – such as a character indicating the start of a message, or when the shift key was pressed.
Each character in the character set has a code associated with it. The Excel CHAR function returns the character associated with a given code.
How to Use the CHAR Function
To use the Excel CHAR Function, type the following:
In this case, Excel will return a capital “A”, since 65 is the code associated with that character.
Displaying Special Characters in Excel
The CHAR function is most commonly used to display special characters.
For example, if you needed to display the copyright symbol, how would you do that? Perhaps you’d look up a keyboard shortcut, or find one elsewhere to copy and paste.
An easier way is to use CHAR, and specify the character code for the copyright sign (169):
As this example also demonstrates, you can use a cell reference in CHAR.
Which Characters Can You Display?
Of course, to use CHAR effectively you need to know what characters are available in the character set:
- Windows uses the Windows-1252 character set (sometimes called “ANSI”)
- Apple computers use the Mac OS Roman character set (sometimes just called the “Macintosh character set”)
Note that if you’re using Excel for the web, you can only use character codes 9, 10, 13, and 32 and above.
If you want to find the code for a particular character, you can use the Excel CODE Function for that. For example:
Will return 65.
Using CHAR to create line breaks
Say you have a list of addresses, with each part of the address in a different column. You want to condense all of these into one cell, perhaps to make mailings easier.
Instead of manually pasting each element of the address into a new cell, and using Alt + Enter to insert line breaks, you can use Excel to automate this task:
Here we use the & symbol to combine each section of the address into one cell, and we separate them with CHAR(10), which is the code for a line break on Windows. If you’re a Mac user, use CHAR(13).
Note that you’ll need to select “Wrap Text” for the line breaks to show on your screen.
Displaying Double Quotes in a Formula
Imagine you have a formula that creates a string of text, and you need the string to contain double-quotes. If you try to type in the double quotes, Excel will interpret this as the end of the string, so you’ll likely get an error.
One way to do this, is to put two double quotes in a row, as shown below:
=B3&" """&C3&""" "&D3
However, this can look a little confusing in the formula bar, making it hard to edit. An alternative is to use CHAR(34) to display the double quotes:
=B3&" "&CHAR(34)&C3&CHAR(34)&" "&D3
Both methods are valid – just use whichever feels the most natural to you.
CHAR Vs. CODE
The Excel CODE Function is effectively the opposite of CHAR. You give it a character, and it returns the associated code.
Will return 65 , and revers also work in the same way. You can get total picture by referring below screen shot.
I know this is repeated from above, but I thought I’d give it its own section too. So it appears in the contents in case that’s what people were specifically looking for.
CHAR in Google Sheets
The CHAR Function works exactly the same in Google Sheets as in Excel:
The CODE Function converts a code into the corresponding character. The CODE Function does the reverse. It converts a character into it’s corresponding code.