Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Convertion Formula

Status
Not open for further replies.

ESTAGroup

Technical User
Aug 12, 2004
53
0
0
US
I need to convert a date (e.g. 1/1/2005) to a number 20050101 or convert the other way. Does anyone know a formula that can do either one for me? I do not want to convert to a serial number.

Thank you.
 
Change 20050101 to 1/1/2005:

Enter this formula in a helper cell:
=MID(A1,5,2)&"/"&RIGHT(A1,2)&"/"&LEFT(A1,4)

Select it, hit copy, and then choose Edit Paste Special, and choose Values.

Put a 1 in a cell - out of the way somewhere.

Select and copy the cell with the 1 in it.

Select the cell that used to have the long formula in it and Edit > Paste Special - choose Multiply/

Apply the date format of your choice.

 


Hi,

Very simple, IF you have REAL DATES
[tt]
=Text(A1,"yyyymmdd")
[/tt]
Why do Dates and Times seem to be so much trouble? faq68-5827

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Hi Skip, If you will notice surferboy's other post in this forum, you'll see why I think the "real dates" is a big "not"!

 
Hi surferboy,

To change the string '1/1/2005' to a string '20050101', you could use:
=TEXT(DATEVALUE(A1),"yyyymmdd")
or
=VALUE(TEXT(DATEVALUE(A1),"yyyymmdd"))
to change it to the equivalent number.

Cheers
 


Lilliabeth,

???

Don't understand what you mean

???

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 


Gocha!

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top