Importing Data

toleafs

Active Member
Joined
Jun 27, 2005
Messages
498
Hello
Any advice is appreciated...I am importing a text file into a table. I am having an issue with Date format.
The text file date is DMY. It can be shown as:

11210
171210

I am having trouble formatting to recognize the single day digit and double day digit.
Hope this makes sense.
Thanks in advance for your help
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Since it is inconsistent, I would import it as Text and them convert it using a calculation in a Query.
 
Upvote 0
That calc might look something like:

Code:
DateCalc: DateSerial(Right(Format([DateField],"000000"),2),Mid(Format([DateField],"000000"),3,2),Left(Format([DateField],"000000"),2))
where DateField is the field you are importing in Text format.

By the way, I am assuming that the month portion has leading zeroes, i.e. April 4, 2010 would be coming over as:
40510
and not
4510
or else you could have real problems!

For example, if that was the case, November 1, 2010 and January 1, 2010 would be represented the same way, i.e.
11110
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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