ExcelFunctions.net Logo

The Excel CHAR Function

Home » Excel-Built-In-Functions » Excel-Char-Function

Search this site:
Custom Search
Related Function :

Character Encoding

The character encoding used by your computer will depend on the operating system used - Windows uses the ANSI character set, whereas Macintosh uses the Macintosh character set.

Therefore, the characters returned by the Excel Char Function for specific number codes may differ across operating environments.

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 format 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.


Examples

The following spreadsheet shows examples of the Excel Char function used 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 result is shown in the spreadsheet on the right - Note that these results are from the Ansi character set (used on the Windows operating system).

 Formulas
Examples of use of the Excel Char Function
 Results
Excel Char Function Results

Note that cell B5 in the above example spreadsheet, is provided with the value 256, which is outside of the range of allowed values 1 to 255. Therefore, in this case, the Char function returns the Excel #VALUE! error.


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
Example of use of the Excel Char Function
 Result
Excel Char Function Result

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





Valid XHTML 1.0 Transitional

Disclaimer Privacy Policy

Copyright © 2008-2010 ExcelFunctions.net