I have a data file with timestamps in this TEXT format:
June 11, 2012 3:47:56 PM GMT-07:00
I need to do calculations such as time difference between different entries, so obviously I have to re-format the timestamp into something that Excel can do math on.
Optimally, this format should work I think:
6/11/2012 3:47:56 PM
…
Here’s what I’ve done so far … use MID combined with DATEVALUE to get the date (my timestamp is in cell A8):
=datevalue(mid(a8, 1, find(",",a8)+5))
which results in this being displayed:
11-Jun-12
I can calculate difference in days now, but my ‘customer’ wants the data in hours and minutes as well.
So I thought perhaps I could use TIMEVALUE and MID to parse the time portion of the same timestamp, but I’m at a loss on how to efficiently calculate the length parm for MID properly. The timestamp can be either 11 or 10 characters in length depending on the time displayed since it doesn’t use a preceeding zero for times before 10 a.m.
If there are better or easier ways to do the translation / reformatting of the timestamp, I’d love to hear about it.
Assuming there’s always going to be AM or PM, then the value is:
=DATEVALUE(LEFT(A8,FIND("M",A8,2)))+TIMEVALUE(LEFT(A8,FIND("M",A8,2)))Edited to avoid
MayandMarch, thanks @barry