Import dates from text with milliseconds

kristoh

New Member
Joined
Aug 20, 2008
Messages
8
I'm trying to open a text file (comma separated) containing a column of dates (in the format 2008-06-29 14:48:15:973). As far as I understand, Excel needs milliseconds in the format 2008-06-29 14:48:15.973 (period as delimiter before milliseconds). When I manually change the colon to period in the cell, excel manages to recognize it as a date. However, as I have 21000 entries, I would like to do this automatically. So I create a new column, enter the formula: =replace(A4, 20, 1,".") and I there see the correct output with the '.' in stead of ':'. But Excel still doesnt recognize this as a date (so I can apply other formatting or do computation on it). Can anybody explain to me what is going on, and/or how I can automatically get Excel to recognize these values as dates? I guess it might be possible to manipulate the text file outside excel, but i'd rather do it in excel as I will be doing with several files later.
<table x:str="" style="border-collapse: collapse; width: 115pt;" border="0" cellpadding="0" cellspacing="0" width="153"><col style="width: 115pt;" width="153"><col> <tbody></tbody><tbody><tr style="height: 12.75pt;" height="17"></tr></tbody></table><table x:str="" style="border-collapse: collapse; width: 115pt;" border="0" cellpadding="0" cellspacing="0" width="153"><tbody><tr style="height: 12.75pt;" height="17"></tr></tbody></table>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Your formula outputs a text string. Use a mathematical operator to convert this to a number again. Either double minus, plus zero or times one:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
=--REPLACE(A4, 20, 1,".")
=REPLACE(A4, 20, 1,".")+0
=REPLACE(A4, 20, 1,".")*1
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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