String of Text Converts into a Date ???

RoaringLion

New Member
Joined
May 30, 2006
Messages
23
Hello,

I have a CSV export file containing a column of model numbers of products. Some of these model numbers unexpectedly convert into dates.

Example: A cell of 2569-4/4 converts into 4/4/2569.

I tried exporting the csv file and saving it to disk; then opening up a blank worksheet; formatting that whole blank sheet into text; then importing the csv file into that blank worksheet - also selecting text on the import.

That did not work. Similar model numbers to the example above still converted into a date. By the way, I checked the format of the cells that were converted into a date, and sure enough, they were listed as being formatted as a date.

How can I access my Model Numbers without having them convert into dates?

Please Help...
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Are you:
i. exporting an Excel file to a CSV,
ii. importing a CSV into Excel, or
iii. just trying to view the CSV file (and you end up using Excel to view it)?

Don't trust what Excel says the CSV file has in it. Open it up in a Text Editor, like NotePad to view it to see what is actually has in it (text files are not stored with any formatting, however when you use Excel to view a CSV file, Excel makes some assumptions as to what formats columns should have).

If you need to import the CSV into Excel, instead of opening it directly into Excel, open a blank Excel sheet and open using Data | Import External Data | Import Data and browse to your file. This will invoke the Import Wizard, where you can specify the format of each column. Make sure the column in question is formatted as Text instead of General or Date.
 
Upvote 0
Thank you for the reply.

After exporting a CSV file from the admin panel of a website, I try to open it up in Excel. In Excel, those model numbers convert into dates.

I opened up that same CSV file in Notepad and the model numbers are correct (i.e., not dates).

Then I tried the following process: I tried opening up a blank worksheet; formatting the entire worksheet to text; then importing external data from text; for Column Data Format, I select Text and then do the import. The Result: those model numbers that were supposed to be formatted to text throughout the whole process were converted into dates ??????

Then I experimented by opening up the CSV in Notepad; replacing the hyphen of one model number from "-" to "?-?" ; copy-pasting the resulting text file into an Excel worksheet.; finding the one cell with the "?-?"; formatting it as text; and then using Find-Replace to remove the extra "??". That didn't work either as it was again converted into a date. (Although, by manually going into that cell and backspacing those 2 ?s the cell remained as text and did not convert into a date; but I have a few thousand rows - way too many to do manually.)

How can I get Excel to open up these model numbers as text and not as dates ???? (By the way, I am using Office 2007 if that helps.)
 
Upvote 0
I just want to verify how exactly are you importing the CSV file into Excel. You should go to the Data menu and use Get External Data, then Import Text File
(Note: it may be this, or what I posted in the previous post -- it depends on what version of Excel you are using; either way you will begin under the Data menu).

Then after you browse to your file and the Import Wizard is invoked, on Step 3, make sure you choose the Text format for THAT column (note that if it is not your first column, you will need to cycle through and select the appropriate column -- if you just select Text on the first column, that is the only column it will format that way, and it won't format the column you are trying to fix).

If you do this, Excel should NOT re-format that column as Date. It will appear just as it does in NotePad.
 
Upvote 0
I just tried that and the first time it did indeed re-format it.

Then I tried it again and in the External Data Properties, I changed the default setting by unchecking "Preserve Cell Formatting".

That worked !!!

Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,225,354
Messages
6,184,459
Members
453,233
Latest member
bgmb

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top