How to Use the CHAR Function in Excel – 8 Examples

The American System Code for Information Interchange, or ASCII, is a character encoding standard used in digital communications. A unique integer number is assigned to each character that can be entered in the CHAR function. The character can be a number, alphabet, punctuation marks, special characters, or control characters. For Example,  the ASCII code for [comma], is 044. The lowercase alphabets a-z have ASCII values ranging from 097 to 122.

Excel CHAR Function Overview

 

The CHAR Function

 Objective

The CHAR function returns the character specified by its code number.

Syntax

CHAR(number)

Syntax

 Argument Explanation

Argument Required/Optional Explanation
number Required A number between 1 to 255 assigned to a specific character

Output

The CHAR function returns a character based on the number given as argument.

output

 


Example 1 – Add Two Strings Using The CHAR Function

  • Enter the following formula in an empty cell (C7),
=B7 &CHAR(45)& B8

The formula will add the strings in B7 and B8 with a hyphen and return the output in C7. (to add other characters, insert a different code. For example, 44 for comma or 32 for a space).

Join two string

  • Press ENTER.

You’ll see the two strings joined by a hyphen in C7.

Excel CHAR function


Example 2 – Add a Character to a String

To add a # to the product code:

  • Enter the following formula in an empty cell (C7).
=B6&CHAR(35)

The formula will add a # (code 35) to the text in B6 and return the output in C7.

add character

  • Press ENTER.

You’ll see a  #  added to the text in C7.

Excel CHAR function

Read More: Character Codes for CHAR Function in Excel


Example 3 – Remove a Character from a String

To remove the # from the string in B7:

  • Enter the following formula in C7.
=SUBSTITUTE(B7,CHAR(35),"")

The CHAR function will return the character # for the code 35 and the SUBSTITUTE function will remove it from B7, replacing it with an empty string.

substitute

  • Press ENTER.

The character was removed.

Excel CHAR function


Example 4 – Add Two Strings with a Line Break Using the CHAR Function

  • Enter the following formula in C7.
=B7&CHAR(10)&B8

The formula will join the texts in B7 and B8 with a line break (character code 10).

line break

  • Press ENTER.

This is the output.

excel char function


Example 5 – Replace a Line Break with a Comma using the CHAR Function

  • Enter the following formula in C7.
=SUBSTITUTE(B7,CHAR(10),CHAR(44))

CHAR(10) returns a line break and CHAR(44) returns a comma. The SUBSTITUTE function replaces the line break with a comma.

excel char function

  • Press ENTER.

This is the output.

replace line break

Read More: How to Insert a New Line Using CHAR Function in Excel


Example 6 –  Using the CHAR Function to Create a List of Characters

  • Enter the following formula.
=CHAR(ROW())

The formula returns the first character.

  • Press ENTER.
  • Drag Fill Handle to the 255th cell.

You will get the complete list of the characters.

excel char function

Read More: How to Use CHAR(32) Formula in Excel


Example 7 – Create a List of Alphabets in Excel

  • Create a list of numbers from 1 to 26 for each alphabet letter.
  • Use the following formula.
=CHAR(B5+64)

64 was added to each serial number as the alphabet code starts from 65.

Creating List of Alphabets in Excel


Example 8 – Check If the ASCII Values Are Correct for a List of Characters

  • Use the function:
=IF(CHAR(C5)=B5,"Correct","Incorrect")

Checking If ASCII Values Are Correct for List of Characters

Read More: How to Convert Excel ASCII to Char


Things to Remember When Using The CHAR Function

  • The CODE function can be used as a reverse CHAR function. For example, enter =CODE(“A”), it will return 65.
  • The CHAR function can not return all characters. For advanced characters, use the UNICHAR function.

Frequently Asked Questions

1. Can I use the CHAR function to insert non-printable characters?

Yes, you need to specify their ASCII or Unicode codes.


Download Practice Workbook


Excel CHAR Function: Knowledge Hub


<< Go Back to Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Prantick Bala
Prantick Bala

PRANTICK BALA is a marine engineer who loves exploring Excel and VBA programming. Programming, to him, is a time-saving tool for efficiently managing data, files, and internet tasks. He is proficient in Rhino3D, Maxsurf, C++, MS Office, AutoCAD, Excel, and VBA and goes beyond the basics. Armed with a B.Sc in Naval Architecture & Marine Engineering from BUET, he has transitioned into the role of a content developer. Beyond his work, find him immersed in books, exploring new... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo