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: Converting Text to Values.

Converting Text to Values

Written by Allen Wyatt (last updated January 27, 2024)
This tip applies to Excel 97, 2000, 2002, and 2003


1

If you are using Excel to massage data imported from another system, you know that often the data needs quite a bit of work. For instance, you might import information that represents a time value, but the data actually ends up being treated by Excel as a text string.

If you find your data in this condition, all is not lost. If you want to convert the text values into actual time values, there are several ways you can accomplish the task. The first is to follow these steps:

  1. Insert a blank column to the right of the data you need to convert.
  2. Just to the right of the first cell that has a text-formatted time value, enter the following formula. Make sure you substitute the address of the cell for A1:
  3.         =VALUE(A1)
    
  4. Copy the formula down, so that each cell to be converted has the formula to its right.
  5. Select the column in which you just put the formulas.
  6. Press Ctrl+C. This copies the selected information to the Clipboard.
  7. Choose Paste Special from the Edit menu. Excel displays the Paste Special dialog box. (See Figure 1.)
  8. Figure 1. The Paste Special dialog box.

  9. Make sure the Values radio button is selected.
  10. Click on OK. All your formulas are replaced with actual values.
  11. Format the column using a desired Time format.
  12. Delete the original text-formatted time column.

Once you get going with this process, it is pretty quick. Not as quick, however, as the following approach:

  1. Select the cells that contain the text-formatted times. If it is an entire column, select the entire column.
  2. Choose Text to Columns from the Data menu. Excel launches the Convert Text to Columns Wizard. (See Figure 2.)
  3. Figure 2. The Convert Text to Columns wizard.

  4. Don't worry about any of the settings in the Wizard—your data should be converted just fine with the defaults.
  5. Click on Finish.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2745) 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: Converting Text to Values.

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

Changing Stubborn Ruler Measurements

Can't get the Ruler to reflect the measurements you want? Chances are good that you are suffering from a glitch caused by ...

Discover More

Finding Related Words

One part of the grammar tools provided with Word is a thesaurus that helps you find all sorts of word variations. One ...

Discover More

Quickly Changing Tab Alignment

Need to change the alignment of some tabs in a multitude of paragraphs? How you approach the problem depends on whether ...

Discover More

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!

More ExcelTips (menu)

Editing Individual Cells

Need to edit the data within a cell? There are any number of ways you can perform the edit; this tip documents them all.

Discover More

Noting When a Workbook was Changed

Do you need to know when a workbook was last changed? There are a couple of ways you can go about keeping track of the ...

Discover More

Deleting Old Data from a Worksheet

If you keep on-going data in a worksheet, some of your dataâ€"over timeâ€"may need to be deleted. If you have an ...

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 two more than 7?

2024-01-27 08:41:53

Ron S

PowerQuery is also a good option if you expect to get more new data that also will need to be cleaned up.

The import process will do some simple automatic conversions for you, text to numbers, text to dates (if it recognizes the format). Which you can easily undo if you don't like them.

Then you can make what ever other additional changes you want.

PQ records all of the changes. After you add new data you just use the refresh function to import the new data, apply all of the required changes and output it to the table.

PQ allows you to pick commands from the ribbon to apply changes. It displays the changes in real time. The underlying code for each change is saved as a separate "Step" in the "Query". Changes/steps can easily be undone.

PQ takes some time to get used to and to learn but it is a huge time saver if you do any amount or repeat data cleaning. If you use Excel for data anlysis PQ is a very worth while to invest some time, and maybe money for courses, to learn it.


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.