Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

convert date from string to date format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Howard - JC Publishing - 09 Apr 2008 17:11 GMT
I am importing data from our database into Excel.  The database program
stores dates as a string such as 20080124.  I want to convert that string the
mm/dd/yyyy.

Thank you.
timmg - 09 Apr 2008 17:30 GMT
On Apr 9, 11:11 am, Howard - JC Publishing
<HowardJCPublish...@discussions.microsoft.com> wrote:
> I am importing data from our database into Excel.  The database program
> stores dates as a string such as 20080124.  I want to convert that string the
> mm/dd/yyyy.
>
> Thank you.

Assuming the value in A1 the formulae:

=MID(A1,5,2)&"/"&RIGHT(A1,2) &"/" &LEFT(A1,4) will produce a text
value

and

=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2)) will produce a date that can
be formatted to what you want
Ron Rosenfeld - 09 Apr 2008 18:03 GMT
>I am importing data from our database into Excel.  The database program
>stores dates as a string such as 20080124.  I want to convert that string the
>mm/dd/yyyy.
>
>Thank you.

First convert it to a real Excel date:

=DATE(INT(A1/10^4),MOD(INT(A1/10^2),100),MOD(A1,100))

Then, either format the cell as you wish, or use the TEXT function:

=TEXT(DATE(INT(A1/10^4),MOD(INT(A1/10^2),100),MOD(A1,100)),"mm/dd/yyyy")

--ron
Gord Dibben - 09 Apr 2008 20:20 GMT
Data>Text to columns>Next>Next>Column Data Format>Date>YMD and Finish

Gord Dibben  MS Excel MVP

>I am importing data from our database into Excel.  The database program
>stores dates as a string such as 20080124.  I want to convert that string the
>mm/dd/yyyy.
>
>Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.