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: Defeating Automatic Date Parsing.

Defeating Automatic Date Parsing

Written by Allen Wyatt (last updated April 16, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


Excel is normally pretty smart when it comes to importing data, but sometimes the automatic parsing it uses can be a real bother. For instance, you may import information that contains text strings, such as "1- 4- 9" (without the quotes). This is fine, but if you do a Replace to get rid of the spaces, Excel automatically converts the resulting string (1-4-9) to a date (1/4/09).

One potential solution is to copy your information to Word and do your searching and replacing there. The problem with this solution is that when you paste the information back into Excel, it will again be parsed as date information and automatically converted to the requisite date serial numbers.

The only satisfactory solution is to make sure that Excel absolutely treats the resulting strings as just that—strings—and not as dates. This can be done in one of two ways: just make sure that the original text begins with either an apostrophe or a space. This can be ensured by using the Replace feature of Excel (depending on the data you have to work with) or by using the Replace feature of Word (which is much more versatile).

With an apostrophe or space at the beginning of the cell entry, you can remove additional spaces or characters from the cell contents. If the result is text that looks like a date, Excel will not parse it as such because the leading apostrophe or space forces treatment as text.

Another way to perform the task is to follow these steps. (Assume that the original data is in the range A2:A101).

  1. Insert a column to the right of the original data.
  2. In cell B2, enter the following formula:
       =SUBSTITUTE(A2," ","")
  1. Copy the contents of B2 into the range B3:B101.
  2. Select the cells in the range of B2:B101.
  3. Press Ctrl+C to copy the range to the Clipboard.
  4. Select cell A2.
  5. Choose Paste Special from the Edit menu. Excel displays the Paste Special dialog box. (See Figure 1.)
  6. Figure 1. The Paste Special dialog box.

  7. Make sure the Values option is selected.
  8. Click on OK.
  9. Delete column B.

These steps work because the output of the SUBSTITUTE function is always treated as text. When you copy and paste text values, they are treated as text with no additional parsing done by Excel.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3019) 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: Defeating Automatic Date Parsing.

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 the Reviewing Toolbar

The Reviewing toolbar is a handy location for many of the tools often used by editors when working on a document. Here's ...

Discover More

Locking the Print Area

Excel allows you to specify an area of your worksheet that should be printed. Here's how to "lock" that area so it cannot ...

Discover More

Removing HTTP from URLs

Having problems when it comes to replacing information in URLs? You're not the only one; it can be confusing making mass ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

Wrapping Your Text

Want to see all the text that is in a cell, even if it is quite a bit? You need to make sure that text wrapping is turned ...

Discover More

Changing the Percent Symbol

Some symbols can be easily changed in Excel or in Windows, such as the symbols used for currency and to separate ...

Discover More

Unable to Format Cells

If you ever get to a situation where you can no longer format cells in a workbook, you'll realize just how important the ...

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 8 - 5?

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.