Converting Data to Date Type from General Type

tanda

New Member
Joined
Feb 18, 2002
Messages
13
I have imported data that is formatted as General. I need it formatted as Date. The form is 20010207 whcih represents February 7, 2001. The Format, Cells option to format as a Date returns #############, etc.

I need to be able to convert/format to a Date type in VBA in order to do some calculations with the dates (for example, use one date and sort remainders for those within 60 days). This process will be done in VBA code.

I cannot get the cell values recognized as Date types in any way.

Any help would be appreciated.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Highlight your column and try using text to columns under the data menu. When the wizard comes up, hit next, next again, then click on the date radio dial. Select YMD if your desired result is feb 7, or YDM if it is July 2. Finally hit finish. good luck
 
Upvote 0
Try the following (been there):

Choose Text to Columns from the Data Menu
When the Text Import Wizard appears click Next twice.
Change the Column Data Format to date and choose your desired format from the drop down control.
Choose Finish.

Incidentally, you can record this in a macro...

Cheers,

Nate
This message was edited by NateO on 2002-02-19 19:59
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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