CHAR()

Syntax. CHAR(number)

Definition. The CHAR() function returns the character corresponding to the code indicated by the number argument.

Arguments

Background. Use the CHAR() function to convert the encoding in files created on other computers into characters. You can also use this function to insert nonprintable characters, such as line breaks, into calculated strings.

The CHAR() function is the counterpart of the CODE() function, which returns the code of a character. The character generated for a given code depends on the character set used by your computer.

Example. If you use special characters, such as quotation marks (”), the formula is more complicated. To replace an apostrophe (’) with double quotation marks, use the following formula:

=SUBSTITUTE(E2,"'","""")

Example. Assume that cell A2 contains the text The ‘apostrophe’. The formula results in The "apostrophe". Though you only had to put the word apostrophe in double quotation marks, you had to enter four double quotation marks instead of three in the third argument.

This is complicated because the double quotation mark is now the text. An alternative is:

=SUBSTITUTE(E2,CHAR(39),CHAR(34))

Decide for yourself which formula works better for you.

See Also

CODE()