Converting a text string into date+time value

Mauro1234

New Member
Joined
Mar 1, 2017
Messages
3
Hello, I'm looking for a way to convert a text string into a format that Excel recognizes as date+time. Excel version used is 14.0.7177.5000 (32 bit) Italian localization, part of Office 2010

My source text format is like this inside a single cell

Feb 15, 2017 3:01:01 PM

I need to convert into anything that is recognized as date + time in a single cell (should be in a single cell because I'll use these dates to plot data into a chart)

I have tried a number of options

  • Changing cell format from text to date (or to time), but the source text string is not interpreted and the output is not treated as date+hour
  • Sorting day-month-year-hour with a series of MID() and CONCATENATE() functions, but the output is still not recognized as date-hour. Used formula was =MID(A1,5,2)&CONCATENATE("/")&MID(A1,1,3)&CONCATENATE("/")&MID(A1,9,4)&CONCATENATE(" ")&MID(A1,14,15) where A1 is a cell containing the source text
  • DATEVALUE() formula: only manages dates without time
  • TIMEVALUE() formula: only manages hours, even if the final formatting includes dates, the formula ignores anything in the input that is not an hour (as stated in the Excel documentation)

Thank you in advance for any idea and help you may provide
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
try

=DATEVALUE(MID(A1,5,2)&CONCATENATE("/")&MID(A1,1,3)&CONCATENATE("/")&MID(A1,9,4))+TIMEVALUE(MID(A1,14,15) )

But what does 1-9 of the month look like ?

01 or just
1

does the day always have a comma after it ?
you could use a search for , and then you can pick up single digit or double digit days
=DATEVALUE(MID(A1,(SEARCH(",",A1,1)-2),2)&CONCATENATE("/")&MID(A1,1,3)&CONCATENATE("/")&MID(A1,SEARCH(",",A1,1)+1,5))

=DATEVALUE(MID(A1,(SEARCH(",",A1,1)-2),2)&CONCATENATE("/")&MID(A1,1,3)&CONCATENATE("/")&MID(A1,SEARCH(",",A1,1)+1,5))+TIMEVALUE(MID(A1,13,17) )
 
Last edited:
Upvote 0
your formula will not work if days 1-9 are not displayed as 01 - 09
 
Upvote 0
Something like this?

=DATEVALUE(TEXT(CONCATENATE(MID(D1;5;2);" ";LEFT(D1;3);" ";MID(D1;9;4);" ";RIGHT(D1;10));"dd-mm-jjjj"))+TIMEVALUE(RIGHT(D1;10))
 
Upvote 0
Something like this?

=DATEVALUE(TEXT(CONCATENATE(MID(D1;5;2);" ";LEFT(D1;3);" ";MID(D1;9;4);" ";RIGHT(D1;10));"dd-mm-jjjj"))+TIMEVALUE(RIGHT(D1;10))

Mine looks like this but is't basically the same as yours:

=DATEVALUE(MID(A1,5,2)&CONCATENATE("/")&MID(A1,1,3)&CONCATENATE("/")&MID(A1,9,4)&CONCATENATE(" ")) + TIMEVALUE(MID(A1,14,15))
 
Upvote 0
Hi, here's a couple of other options:


Excel 2013
AB
1Days are always 2 digit
2Feb 15, 2017 3:01:01 PM15/02/2017 15:01:01
3Feb 01, 2017 3:01:01 PM01/02/2017 15:01:01
4
5Days can be 1 digit
6Feb 15, 2017 3:01:01 PM15/02/2017 15:01:01
7Feb 1, 2017 3:01:01 PM01/02/2017 15:01:01
Sheet1
Cell Formulas
RangeFormula
B2=0+(MID(A2,5,2)&REPLACE(A2,4,4,""))
B6=0+(MID(A6,5,FIND(",",A6)-5)&REPLACE(A6,4,4,""))
 
Upvote 0

Forum statistics

Threads
1,215,504
Messages
6,125,183
Members
449,212
Latest member
kenmaldonado

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