Extract Date & Time Attributes into separate cells

MOCCOM

New Member
Joined
Aug 11, 2017
Messages
6
I have a report that outputs date-time stamps in the following format: July 13th 2017, 11:40:21.553, and need to extract Day, Month, Year and Time in separate columns and then recombine them to create a valid date-time stamp. Please help!


Sample below illustrates the consistency of the strings - notice variations occur in terms of 1. length of characters in the month name 2. characters following the date i.e. st, nd, th

April 24th 2017, 11:40:29.703
August 1st 2017, 10:10:23.773
August 2nd 2017, 12:08:33.933
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
The solution is simple IF Excel detect that as a date and come with 2 choice

1.
A1 : where your data is
B1 : Day(A1)
C1 : Month(A1)
D1 : Year(A1)
E1 : A1-Int(A1)

2. Copy your value in different cell.
For the day, use the format dd
For the month, use the format mmmm
For the year, use the format yyyy
For the time, use the format h:mm:ss

If Excel doesn't detect your value as a date. You can use the text to columns tool inside Excel and put a space as your separator.
 
Upvote 0
Thanks Roxxien. I'm actually looking for formula-based solutions, because the data will be added to each week, and this is the ideal solution for the user(s). Excel does not detect these values as dates - so I'm looking for text string extraction formulas.
 
Upvote 0
Ok, if you need a text string formulas, I create those for you.

I will just need to search a bit because I normally use macro to do that but I know that there is an Excel formula for this.

I will come back as soon as I have it.
 
Upvote 0
A1 : where your data is
B1 : =MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1))
C1 : =MID(A1,1,FIND(" ",A1)-1)
D1 : =MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,FIND(",",A1)-FIND(" ",A1,FIND(" ",A1)+1)-1)
E1 : =MID(A1,FIND(",",A1)+2,LEN(A1)-FIND(",",A1))

Those formula should solve your problem perfectly.

However, I'm sure there is a simpler solution, but I don't know it.
 
Upvote 0
Super! Amazing... I was really struggling with these. Thank you. Is there an easy modification to the Day formula so I can just return the number - without the st, nd and rd at the end e.g. 21(st)?
 
Upvote 0
not sure if it will always work but this should do the trick, I think

=MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1)-2)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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