I have a column that is text formatted like 20110408_2041
. How can I format it to date/time format?
Answer
Assuming that your string is coded YYYMMDD_HHMM for Year, Month, Day, Hour, Minute, then you can construct an Excel formula to generate a cell in date/time format.
If the string is in cell A1, then this formula ought to do it:
=DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,10,2),RIGHT(A1,2),0)
You will need to format the cell properly to see the time portion. This is tested in LibreOffice calc, but Excel appears to have the same functions.
Comments
Post a Comment