bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Files > Stopping Date Parsing when Opening a CSV File

Stopping Date Parsing when Opening a CSV File

Summary: You can double-click on a CSV (comma separated values) file in Windows, and Excel obediently opens and loads the file. You may not get the results you expect, however, as Excel may parse some of the values in the file incorrectly. In that case, you need to take greater control over how Excel interprets that data. Here’s how to do it. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

Marc has a user at his company who is trying to open a .CSV file in Excel. Some of the numbers in the file are in the format of "2-1" (or something similar). During the import, Excel parses this information as a date. If the piece of data is clearly something outside a valid date range (such as 2-134), then Excel imports it as would be expected. Marc is wondering how his user can force Excel to not parse this data as dates but to import them as text fields.

There at two easy ways you can approach this issue. First is to import the file in the following manner:

  1. If you are using a version of Excel prior to Excel 2007, choose Import External Data from the Data menu and then choose Import Data from the resulting submenu. If you are using Excel 2007, display the View tab of the ribbon and click From Text in the Get External Data group. Excel displays a standard Open dialog box.
  2. Use the controls in the dialog box to select the .CSV file you would like to open and then click Open. Excel starts up the Text Import Wizard. (Click here to see a related figure.)
  3. Go through the steps of the Text Import Wizard to specify how Excel should interpret the data that it imports from the .CSV file. In one of those steps you can indicate that the non-date columns (the ones incorrectly interpreted as dates) are actually text.
  4. When you are done with the steps of the wizard, click Finish. Your data is imported in accordance with your specifications.

The other way to approach the issue also involves the Text Import Wizard, but how you display it is different. In this approach, you use Windows to rename the file so that it has a .TXT extension instead of a .CSV extension. Now, when you use Excel to open the file, it displays the Text Import Wizard because it isn't quite sure how to interpret what it is going to be loading. You can use the Text Import Wizard in the same manner as already described earlier in this tip.

Tip #3228 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


More Power! For some people, the prospect of creating macros can be scary. Those who conquer their fears, however, find they become much more confident and productive once they learn how to make Excel do exactly what they want. ExcelTips: The Macros is an invaluable source for learning Excel macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of ExcelTips. Learn at your own pace, exactly the way you want.
 
Check out ExcelTips: The Macros today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home
Vital News Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)