How to convert Timestamp which is in Text format to Date only?

gritmanish

New Member
Joined
Nov 19, 2009
Messages
3
Hello Everyone,

I have date like Dec 20 2012 12:00 AM which is in text format. I want it in actual date format lime 12/20/2012. I tried mid,left,right functions and then applying Date() but it shows error in that cell. But it doesn't work. Can anybody help me?

Thanks,
Manish
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
HAve you tried DateValue to see if Excel will recognize it?

<font face=Courier New>    MsgBox DateValue(ActiveCell)</FONT>

Mark
 
Upvote 0
Hi there

Assuming that that the text string is in cell A2. Try

=LEFT(A2,FIND(":",A2)-3)+0

The +0 appears to trick Excel into converting/treating/displaying the text as a date.

Note I use European date formats viz dd mmm yyyy not american ones so I have not tested with American formats.

Regards DavidB
 
Upvote 0
David,

Your formula returns "#VALUE!". No luck man. If you know any macro, that would be fine too.

Thanks,
Manish
 
Upvote 0
Hi Manish

What version of Excel are you using? I initially tried this using Excel 2003. I seem to be getting different behavour in Excel 2007. When I entered the data I put in a leading single quote to force the cell to behave as text entry and entered the text string in European Date format.

Can you confirm that the value in the cell is indeed text using the =cell("type",cell_ref) where cell_ref is the co-ordinates of the cell with the text string in it. This function should return an "l" for a label (text.)

Regards DavidB
 
Upvote 0
This works for me...

A1 = Dec 20 2012 12:00 AM
A2 = Dec 1 2012 12:00 AM

=DATEVALUE(MID(A1,4,3)&"-"&LEFT(A1,3)&"-"&MID(A1,7,5))

Format as Date
 
Upvote 0
Hello Everyone,

I have date like Dec 20 2012 12:00 AM which is in text format. I want it in actual date format lime 12/20/2012. I tried mid,left,right functions and then applying Date() but it shows error in that cell. But it doesn't work. Can anybody help me?

Thanks,
Manish


I used ROUNDDOWN(Date,0), then format as date. That'll strip off the decimal value from the date-timestamp and make it a day only.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,344
Members
448,570
Latest member
rik81h

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