CHAR
Converting Between Characters & Numeric Codes

Basic Description

The Excel Char function returns the character relating to a supplied number (from 1 to 255), within the character set used by your computer.

- note that the character set may vary across different operating systems and so the Char function may return different results on different computers.

The syntax of the Char function is :

CHAR( number )

Where the number argument is a number from 1 to 255, and can be supplied to the function either directly or as a reference to a cell containing a number.

Char Function Examples

Example 1

The following spreadsheet uses the Excel Char function to return the character associated with different supplied numeric values.

The format of the function is shown in the spreadsheet on the left and the results are shown in the spreadsheet on the right - Note that these results are from the Ansi character set (used on the Windows operating system).

 Formulas:
 AB
1   =CHAR( 65 )
2   =CHAR( 97 )
3 63 =CHAR( A3 )
4 51 =CHAR( A4 )
 Results:
 AB
1   A
2   a
3 63 ?
4 51 3

Example 2

One handy use of the char function is when inserting line breaks into text. This is shown in the example below (Note that, in the Ansi character set, the line break is given by the numer code 10) :

 Formula:
 A
1 ="This line contains a" & CHAR( 10 ) & "line break"
 Result:
 A
1 This line contains a
line break

Note that, in the example above, in order to display the result with the line break, you will need to ensure that the cell text wrapping is enabled. To do this :

  • Right click on the cell and select Format Cells ...
  • Select the 'Alignment' tab and check the Wrap text option
  • Click OK

Char Function Error

If you get an error from the Excel Char function, this is likely to be the #VALUE! error :

Common Error
#VALUE! - Occurs if the supplied number argument is not recognised as a numeric value or is a number outside of the permitted range 1 to 255.
Excelq.com doing business as a Service of Venttraffic Media Inc. Excel and other words on this site may be trademarks or registered trademarks of Microsoft Corporation. Microsoft Corporation is not connected in any way with this website, and makes no endorsement of the site or its related contents. All rights reserved. Website powered by Venttraffic Media Inc.