Excel Function: CHAR

Purpose

The CHAR function translates a number whose value lies between 1 & 255 into the character to which it corresponds in the character set of your computer. Because the mapping between numbers & characters differ between character sets and the character sets used by different computers can differ, the output produced by CHAR may vary between computers. For example, in the Windows-1252 character set the number 156 represents the character œ and in the Mac OS MacRoman character set it represents ú. The practical utility of CHAR is that it provides a means through which one can work with useful but difficult-to-access non-printing characters, such as line breaks and carriage returns. However, because of the potential for CHAR to generate different results on different computers, its use is not recommended. Instead, the UNICHAR function is preferred because it offers more capabilities and obviates the portability problems.

Invocations of the CHAR function take the form:

CHAR(number)

Example

Consider a cell containing the formula:

=CONCAT("Hello", CHAR(10), "World")

The formula concatenates “Hello”, CHAR(10) and “World” together and returns the following text value:

Hello
World

CHAR(10) is translated into the new-line non-printing character and is responsible for “Hello” and “World” appearing on different lines.

Arguments

ArgumentArgument typeDescription
numberMandatoryA number which will be translated into a character in your computer’s character set.

Related Functions

FunctionExamplePurpose
UNICHARUNICHAR(number)Translates a number to the character it represents in the unicode character set. Because unicode is a cross-platform standard, the results yielded by UNICHAR are (almost) guaranteed to be consistent on different computers.

Error Conditions

Error valueCondition typeCondition
#VALUE!Bad argumentThe value supplied to the number argument was not between 1 & 255 inclusive.
#VALUE!Bad argumentEither the value supplied to the number argument is not a number or it can’t be treated as one.

Examples

ExampleFormulaResultDescription
1=CHAR(65)ACHAR translates 65 to the character that it corresponds to in your computer’s character set.
2=CHAR("1E2")dCHAR translates the text value “1E2”, which is 100 in scientific notation, into a character.

Examples: Errors

ExampleFormulaResultDescription
1=CHAR(0)#VALUE!The value supplied to the number argument was not between 1 & 255.
2=CHAR("a")#VALUE!The value supplied to the number argument was not a number.