Wednesday, May 09, 2007

Format elapsed time in excel

I have a set of times saved in seconds and fractions of a second. I want to be able to transpose that into something that can be understood easily, such as hours:minutes:seconds
Because Excel does not provide automatic support to measure elapsed time, this unfortunately needs to be done by hand.
Sample input data set (in columns A1-A4):
4508.507
4452.111
4423.425
4592.724

Sample output:
1:15:8.507
1:14:12.111
1:13:43.425
1:16:32.724

Formula (for first value only (i.e., in cell A1)
=INT(A1/3600)&":"&RIGHT("00"&MOD(INT(A1/60),60),2)&":"&ROUND(MOD(A1, 60),3)

Cell value (e.g., A1) can be replaced with things such as SUM (cell range), AVERAGE (cell range), MAX (cell range) to get formatting of the result of processing a range of cell values.

No comments: