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.