Skip to main content

CHAR function

Description

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

Syntax

CHAR(number)

Parameters

Number Required. A number between 1 and 255 specifying which character you want. The character is from the character set used by your computer.

Examples

The example may be easier to understand if you copy the example data (include header) in the following table, and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Formula Result Description
=CHAR(48) 0 Displays the 48 character in the set (0)
=CHAR(65) A Displays the 65 character in the set (A)
=CHAR(90) Z Displays the 90 character in the set (Z)
=CHAR(0) #VALUE! Displays #VALUE! error.
=CHAR(256) #VALUE! Displays #VALUE! error.
=ISTEXT(CHAR(49)) TRUE TRUE. CHAR return text String.

Generate Random Uppercase Letter String (A-Z)

=CHAR(RANDBETWEEN(65,90))

Generate Random Lowercase Letter String (a-z)

=CHAR(RANDBETWEEN(97,122))

Generate Random Number Character (0-9)

=CHAR(RANDBETWEEN(48,57))

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>