I. Intro
The CHAR function returns the character corresponding to a UTF-16 numeric code.
II. About the function
- Formula: =CHAR(number)
- Arguments:
- number (required): The numeric code to be converted (must be between 1 and 255).
- Example:
- =CHAR(67) results in C.
III. Steps
Use the function
- Enter the spreadsheet and enter the function in the cell.
- Press Enter to get the character corresponding to the numeric code.
For example, as shown in the green highlights in the image below, A is returned for =Char(65) and b is returned for =Char(98).
250px|700px|reset
Note: The UTF-16 code contains tens of thousands of different characters. In addition to the more common upper/lower case letters and numbers, it also includes keys (such as spaces), punctuation marks, special letters, and so on.
Common Characters | UTF-16 Code |
Capital letters A-Z | 65-90 |
Lowercase letters a-z | 97-122 |
Numbers 0-9 | 48-57 |
Line feed | 10 |
Space | 32 |
Delete the function
Select the cell with the CHAR function and press Delete.
IV. Use cases
Add line breaks to text
You can combine information from multiple cells into one cell and use CHAR(10) to insert line breaks to separate the information.
Take the following image as an example. To combine the name in A2 and the class information in B2 and display them on separate lines within the same cell, you can use the formula A2&CHAR(10)&B2.
250px|700px|reset
Enter the letters A-Z
You can quickly enter the letters A-Z in the columns using the CHAR and ROW functions.
Take the following image as an example, the UTF-16 codes for A-Z range are 65-90. You can first get the numbers 65-90 through the ROW function, and then convert them to the corresponding letters A-Z through the CHAR function.
250px|700px|reset
Remove linebreaks in text
If you want to remove line breaks from text, you can use the SUBSTITUTE function to replace the line breaks with spaces. The line break is represented by CHAR(10), and the space is represented by CHAR(32).
For example, you can use SUBSTITUTE(A2,CHAR(10),CHAR(32)) to replace the line breaks in cell A2 with spaces, as shown in the image below.
250px|700px|reset