The use range and example of the char, CHR and CHRW functions in Excel

Source: Internet
Author: User
Tags character set chr

Functions of Char, CHR, ChrW three functions: All three functions take the character code as the parameter and return the character corresponding to the code.

A char function can be used in a formula

Where the char function is a worksheet function that can be used in an Excel formula, you can return the character corresponding to the ASCII code, with a parameter range of 1~255, such as char (= "A"). Returns an error value when the argument is greater than 255 #value!

Two, CHR, ChrW functions can only be used in VBA

The ①CHR function is a function in VBA that returns the character corresponding to the ANSI character code.

When the parameter range is 0~255, the character corresponding to the ASCII code is returned, such as using code range ("A1") =CHR (65) to display the character "A" in the A1 cell.

When the parameter is in the [ -32768,-1] or [256,65535] interval, the function returns the corresponding character of non-Unicode in the current character set, such as using code Range ("A1") = Chr (33119) to display the character "A1" in the book cell.

The ②CHRW function is also a function in VBA that returns the character corresponding to the ANSI character code.

When the range of arguments is 0~255, the character corresponding to the ASCII code is returned, the same as the CHR function, for example, using the code

Range ("A1") =CHRW (65)

You can display the character "A" in cell A1. When the parameter is in the [ -32768,-1] or [256,65535] interval, the function returns the corresponding character for Unicode in the current character set, for example, by using code Range ("A1") = ChrW (33119) to display the character "A1" in the 腟 cell.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.