Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Returning an ANSI Value.
Written by Allen Wyatt (last updated September 9, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
You may have a need to determine the ANSI value of the text in a particular cell. You can do this using the CODE worksheet function. This function returns a numeric value that represents the ANSI value of the first letter in the referenced cell. For instance, if cell A1 contains the text "My Stuff," and that B1 contains the following:
=CODE(A1)
In this instance, B1 will have a result of 77, which is the ANSI value of M, the first character in A1.
If the value in the referenced cell is numeric (such as 34 or 2798), then the CODE function treats the numeric value as if it were text and returns the ANSI value of the first digit in the value. Thus, if A1 contained 34, then CODE would return 51, which is the ANSI value of "3."
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7012) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Returning an ANSI Value.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
If you need to do a lot of work with whole numbers (integers), then you may wonder which of three functions you should ...
Discover MoreNeed to know the column number for use in a formula? The worksheet function you want is the COLUMN function, described in ...
Discover MoreCells can store all sorts of information that can be formatted and displayed in a myriad of ways. If you want to quickly ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-09-09 10:10:54
J. Woolley
Re. ANSI, ASCII, and Unicode, see http://www.differencebetween.net/technology/web-applications/difference-between-ansi-and-ascii/
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments