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: Using a Numeric Portion of a Cell in a Formula.

Using a Numeric Portion of a Cell in a Formula

Written by Allen Wyatt (last updated October 7, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


Rita described a problem where she is provided information, in an Excel worksheet, that combines both numbers and alphabetic characters in a cell. In particular, a cell may contain "3.5 V", which means that 3.5 hours of vacation time was taken. (The character at the end of the cell could change, depending on the type of hours the entry represented.) Rita wondered if it was possible to still use the data in a formula in some way.

Yes, it is possible, and there are several ways to approach the issue. The easiest way (and cleanest) would be to simply move the alphabetic characters to their own column. Assuming that the entries will always consist of a number, followed by a space, followed by the characters, you can do the "splitting" this way:

  1. Make sure there is a blank column to the right of the entries.
  2. Select the entries.
  3. Choose Text to Columns from the Data menu. Excel displays the first step of the Convert Text to Columns Wizard. (See Figure 1.)
  4. Figure 1. The first step of the Convert Text to Columns Wizard.

  5. The Delimited radio button should be selected. Click Next. Excel displays the second step of the wizard.
  6. Make sure the Space check box is selected, then click Next. Excel displays the third step of the wizard.
  7. Click Finish.

Word splits the entries into two columns, with the numbers in the leftmost column and the alphabetic characters in the right. You can then any regular math functions on the numeric values that you desire.

If it is not feasible to separate the data into columns (perhaps your company doesn't allow such a division, or it may cause problems with those later using the worksheet), then you can approach the problem in a couple of other ways.

First, you could use the following formula on individual cells:

=VALUE(LEFT(A3,LEN(A3)-2))

The LEFT function is used to strip off the two rightmost characters (the space and the letter) of whatever is in cell A3, and then the VALUE function converts the result to a number. You can then use this result as you would any other numeric value.

If you want to simply sum the column containing your entries, you could use an array formula. Enter the following in a cell:

=SUM(VALUE(LEFT(A3:A21,LEN(A3:A21)-2)))

Make sure you actually enter the formula by pressing Shift+Ctrl+Enter. Because this is an array formula, the LEFT and VALUE functions are applied to each cell in the range A3:A21 individually, and then summed using the SUM function.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3185) 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: Using a Numeric Portion of a Cell in a Formula.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Using InputBox to Get Data

Need your macro to get some input from a user? The standard way to do this is with the InputBox function, described in ...

Discover More

Removing Line Numbering

If you've added line numbers to your document, at some point you may want them turned off. Here's how to disable line ...

Discover More

Making Custom Heading Styles Appear in the Navigation Pane

Creating styles for your documents is a powerful way to format them. How do you get paragraphs formatting with those ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Listing Combinations

You can easily use the COMBIN worksheet function to determine the number of combinations that can be made from a given ...

Discover More

Deriving High and Low Non-Zero Values

When analyzing your numeric data, you may need to figure out the largest and smallest numbers in a set of values. If you ...

Discover More

Summing Digits in a Value

Want to add up all the digits in a given value? It's a bit trickier than it may at first seem.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four minus 0?

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


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.