# Returning an ANSI Value

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Returning an ANSI Value.

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 (2153) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Returning an ANSI Value.

Related Tips:

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

 *Name: Email: Notify me about new comments ONLY FOR THIS TIP Notify me about new comments ANYWHERE ON THIS SITE Hide my email address *Text: *What is 5+3 (To prevent automated submissions and spam.)

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

# Our Company

Sharon Parq Associates, Inc.

# Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Excel Products

Word Products

# Our Authors

Author Index

Write for Tips.Net