I have an Excel (2010) spreadsheet delivered to me which is basically a text dump.
Cell – J8 has the following info Tue Feb 4 00:08:06 EST 2014
Cell – L8 has the following info Tue Feb 4 00:14:54 EST 2014
I need to calculate the difference in time between L8 and J8.
These cells are formatted as “text” and since they have the day, date, time and “EST” formatting the cells with long date it doesn’t work.
I did this to parse the date/time value of each cell:
Then you can just do a simple subtraction between the values of the two cells.
The only thing I needed to add to the spreadsheet was a lookup table to map month name to month value. Hence the
VLOOKUP in the formula.
I also needed to calculate the offset position past the day value as it appears that it could have either one or two digits – hence the magic
27 numbers in the formula.
Uses an array (column of months MMM, and 1-12) and can surely be improved, but to tide you over:
in say Y8 and copied across to Z8 with
=Z8-Y8 in AA8 may suit (for the ‘time’ being!)
Does not cater for differences in time zones.
If L8 is always later than J8, and if the format is always as you show (with three letters for the timezone, and the spacing as above, then try:
=(MID(L8,5,6)&”, “&RIGHT(L8,4) &” “& MID(L8,11,9))-(MID(J8,5,6)&”, “&RIGHT(J8,4) &” “& MID(J8,11,9))
One further caveat with this method: your native default date (in Windows Control Panel, not in Excel itself) needs to be MDY as in your text dump.
EDIT: The following (longer) version should work no matter if your native date format is MDY or DMY:
=(MID(L8,9,2)& MID(L8,4,4)&RIGHT(L8,5)&" "&MID(L8,11,9))-(MID(J8,9,2)& MID(J8,4,4)&RIGHT(J8,5)&" "&MID(J8,11,9))