Working with time DURATION, not time of day - excel

I'm doing some benchmarking, and I want to use Excel to produce graphs of the results. I've got a simple but annoying problem which is baking my noodle.
The problem is that Excel insists that "time" means a time of day. It refuses to let me work with time durations. When I try to say "three minutes and six seconds", it misinterprets this as "three minutes and six seconds past midnight", which isn't what I meant at all.
I can work around the problem by laboriously converting everything to seconds. But then all my graphs are labelled in seconds, not minutes and seconds. Plus it's a pain to have to keep typing in =3*60+6 rather than just 3:06. And once I've done it, I have to look at the formula to check whether I entered the data correctly [and didn't screw up the formula].
Does anybody know how I can make Excel work with a time duration not anchored to a specific time of day?

You can easily do this with the normal "Time" data type - just change the format!
Excels time/date format is simply 1.0 equals 1 full day (starting on 1/1/1900). So 36 hours would be 1.5. If you change the format to [h]:mm, you'll see 36:00.
Therefore, if you want to work with durations, you can simply use subtraction, e.g.
A1: Start: 36:00 (=1.5)
A2: End: 60:00 (=2.5)
A3: Duration: =A2-A1 24:00 (=1.0)

Use format d "days" h:mm:ss or [h]:mm:ss, depending on your needs.
Say you have a duration of 30h 12m 54s:
h:mm:ss -> 6:12:54 (not correct for a duration)
[h]:mm:ss -> 30:12:54
d "days" h:mm:ss -> 1 days 6:12:54
Variations are possible: I like something like d"d" h"h" mm"m" ss"s" which formats as 1d 6h 12m 54s.

The custom format hh:mm only shows the number of hours correctly up to 23:59, after that, you get the remainder, less full days. For example, 48 hours would be displayed as 00:00, even though the underlaying value is correct.
To correctly display duration in hours and seconds (below or beyond a full day), you should use the custom format [h]:mm;# In this case, 48 hours would be displayed as 48:00.
Cheers.

With custom format of a cell you can insert a type like this: d "days", h:mm:ss, which will give you a result like 16 days, 13:56:15 in an excel-cell.
If you would like to show the duration in hours you use the following type [h]:mm:ss, which will lead to something like 397:56:15. Control check: 16 =(397 hours -13 hours)/24

I don't know how to make the chart label the axis in the format "X1 min : X2 sec", but here's another way to get durations, in the format of minutes with decimals representing seconds (.5 = 30 sec, .25 = 15 sec, etc.)
Suppose in column A you have your time data, for example in cell A1 you have 12:03:06, which your 3min 6sec data misinterpreted as 3:06 past midnight, and column B is free.
In cell B1 enter this formula: =MINUTE(A1) + SECOND(A1)/60 and hit enter/return. Grab the lower right corner of cell B2 and drag as far down as the A column goes to apply the formula to all data in col A.
Last step, be sure to highlight all of column B and set it to Number format (the application of the formula may have automatically set format to Time).

Highlight the cell(s)/column which you want as Duration, right click on the mouse to "Format Cells". Go to "Custom" and look for "h:mm" if you want to input duration in hour and minutes format. If you want to include seconds as well, click on "h:mm:ss". You can even add up the total duration after that.
Hope this helps.

The best way I found to resolve this issue was by using a combination of the above. All my cells were entered as a Custom Format to only show "HH:MM" - if I entered in "4:06" (being 4 minutes and 6 seconds) the field would show the numbers I entered correctly - but the data itself would represent HH:MM in the background.
Fortunately time is based on factors of 60 (60 seconds = 60 minutes). So 7H:15M / 60 = 7M:15S - I hope you can see where this is going. Accordingly, if I take my 4:06 and divide by 60 when working with the data (eg. to total up my total time or average time across 100 cells I would use the normal SUM or AVERAGE formulas and then divide by 60 in the formula.
Example =(SUM(A1:A5))/60. If my data was across the 5 time tracking fields was the 4:06, 3:15, 9:12, 2:54, 7:38 (representing MM:SS for us, but the data in the background is actually HH:MM) then when I work out the sum of those 5 fields are, what I want should be 27M:05S but what shows instead is 1D:03H:05M:00S. As mentioned above, 1D:3H:5M divided by 60 = 27M:5S ... which is the sum I am looking for.
Further examples of this are:
=(SUM(G:G))/60 and
=(AVERAGE(B2:B90)/60) and =MIN(C:C) (this is a direct check so no /60 needed here!).
Note that your "formula" or "calculation" fields (average, total time, etc) MUST have the custom format of MM:SS once you have divided by 60 as Excel's default thinking is in HH:MM (hence this issue). Your data fields where you are entering in your times should need to be changed from "General" or "Number" format to the custom format of HH:MM.
This process is still a little bit cumbersome to use - but it does mean that your data entry is still entered in very easy and is "correctly" displayed on screen as 4:06 (which most people would view as minutes:seconds when under a "Minutes" header). Generally there will only be a couple of fields needing to be used for formulas such as "best time", "average time", "total time" etc when tracking times and they will not usually be changed once the formula is entered so this will be a "one off" process - I use this for my call tracking sheet at work to track "average call", "total call time for day".

Let's say that you want to display the time elapsed between 5pm on Monday and 2:30pm the next day, Tuesday.
In cell A1 (for example), type in the date. In A2, the time. (If you type in 5 pm, including the space, it will display as 5:00 PM. If you want the day of the week to display as well, then in C3 (for example) enter the formula, =A1, then highlight the cell, go into the formatting dropdown menu, select Custom, and type in dddd.
Repeat all this in the row below.
Finally, say you want to display that duration in cell D2. Enter the formula, =(a2+b2)-(a1+b1). If you want this displayed as "22h 30m", select the cell, and in the formatting menu under Custom, type in h"h" m"m".

What I wound up doing was: Put time duration in by hand, e.g. 1 min, 03 sec. Simple but effective. It seems Excel overwrote everything else, even when I used the 'custom format' given in some answers.

Related

How to create a lap time and session time format in excel?

I would like to know how to format some cells in Excel for my fuel formula. I created a simple spreadsheet that is used to take the average lap time and total race session time to calculate the amount of fuel needed to finish the race. The formula I wrote works with decimal based numbers but I am wondering if I can make the spreadsheet better by formatting so someone types their actual lap time and session time, MM:SS.split. instead of having to type the times in decimal format which may become confusing
I wrote a function that will give me the correct fuel calculation but I want the cells to be custom formatted for lap times and session times instead of decimals and still show the total fuel needed as a regular number.
=A2*B2
Expected: |1:00|10:00| 10 Laps |
Actual: |1.00|10.00| 10|
If you are not going to perform any calculations on these numbers, then you can use the formula TEXT(). For the times, you can use something like the below where m means minutes and s means seconds and 1440 is 24 hours*60 minutes (1 in excel is equivalent to 1 day, so you need to divide by 1440 to make a day become a minute):
=TEXT(A1/1440,"mm:ss")
And the below for the laps:
=TEXT(A1, "#"" Laps""")
But if you have to perform calculation on these numbers, then you will have to format the cells directly instead of using the formula (Home > Format > Format Cells > Custom (Under General, or Ctrl+1 on the cell) and use the formatting I used in the text formula, i.e. mm:ss and # "Laps" respectively. For the times however, you will have to manually divide by 1440.
Have you tried changing the data type of the cell to Time?

Time Study in Excel

I am completing a time study and recording time in excel. I have numbers like 2.24, etc.. I am trying to add them and average them and I am getting numbers like 9.76 when I really want 10m and 16seconds. Any thoughts to fixing this?
When I change the format to mm:ss it give me wild answers
If 9.76 is a decimal number and it's is in A1, then in B1 you can use:
=((A1-(ROUNDOWN(A1;0)))/0,6+(ROUNDOWN(A1;0)))/24
Also, format of cell with formula must be hours (I've used [hh]:mm:ss)
Applying this, I get:
I've done it in the following way: I used cell formatting, like u:mm:ss (in English locale, this might be h:mm:ss instead).
In one cell, I've put 0:2:24 (zero hours, two minutes, 24 seconds).
In the cell below, I've put 0:7:52.
Adding both cells (inside a cell with the mentioned cell formatting) yielded 0:10:16.
=9.76 value(minutes)
=24*60 number of minutes in a day
=A1/A2 formatted as time
Will show 12:09:46. You can use =MINUTE(A3) to extract the minutes and =SECOND(A3) for the seconds.
Actually if 9.76 means 9 minutes and 76 seconds, you'll need more formulas to extract the minutes and seconds then add them together. You can use =Floor() to get the integer. Subtract to find the .76 and multiply by 100 to get the number of seconds. Then divide by 60 to convert to minutes and add to the 9 whole mins. Now you have the number of mins which you can convert to a time value per the above.
EDIT:
You need to enter in Excel as 0:02:12 then you can add quite nicely. If you don't want to re-enter everything you can do this: =VALUE("0:"&SUBSTITUTE(A1,".",":")) then add. Be sure to convert each individual value BEFORE adding otherwise you might get incorrect results.

How do i Subtract a duration from a time in Excel?

I am having an issue with Excel and it’s probably very simple but I need to get a starting time by subtracting a duration from and end time.
For example say I know that an event needs to end at 1:55:23 pm and it will take 0:22:13 what formula would I use to find out what time I should start?
I would like to be able to input the duration in the format h:mm:ss without excel trying to turn it into a time and not a duration as well.
Thank you for any suggestions
You simply subtract them.
For example...
Cell A1 has the end time: 1:55:23 PM
Cell B1 has the duration: 0:22:13 (this is the only 'strange' part because it's actually an AM time, as in minutes after midnight... but if you think about it, that's what you want).
Cell C1 has this formula: =A1-B1
That's it.
NOTE: If your duration is longer than your event start time (for example, a 4-hour event that started at 3:00 in the morning!) then the subtraction would result in a negative time.
A negative time is OK in reality, but Excel will not display it as a formatted time... instead it displays a bunch of ############. In that case, you need to display the calculation as a decimal value, which is the fraction of a day. For example. 0.25 means exactly 6 hours. If you would prefer decimal hours you simply multiply the fractional day figure by 24.

Sum time in Excel to show a big number of days

I have cells with duration, specified as hours:minutes:seconds.
1726:48:00
410:10:00
599:20:00
The first line means 1726 hours, 48 minutes and 00 seconds
The second line means 410 hours, 10 minutes and 00 seconds
The third line means 599 hours, 10 minutes and 00 seconds
How do I sum these times in Excel, to get a breakdown in days, hours, minutes and seconds?
I'm afraid that might be impossible by changing the cell format.
If your number is in A1, you could use one of these 2 formulas:
=ROUNDDOWN(A1,0)&TEXT(A1," hh:mm:ss")
=INT(A1)&TEXT(A1," hh:mm:ss")
I also tried =TEXT(A1,"0")&TEXT(A1," hh:mm:ss"), but TEXT(A1,"0") sometimes does roundup which is not welcome.
The drawback of those formulas is that they return text. So you'll not be able to use the results in further calculations.
The requirement is to add a range of cells containing values called “duration”, which are expressed in Date and Time Serial Numbers and to display the result, currently formatted as [h]:mm:ss, in days, hours, minutes and seconds, (a kind of format [d] hh:mm:ss which is not allowed by the Excel application as already explained by ZygD). ZygD also proposed to use a formula to display the desired result as a text which comes with the restriction of further use in other calculations as well explained by ZygD:
=INT(A1)&TEXT(A1," hh:mm:ss")
In case that the total expressed as text needs to be expressed back as a Date and Time Serial Numbers I suggested the formula:
=SUM(LEFT(B1,-1+SEARCH(" ",B1)),
SUBSTITUTE(B1,LEFT(B1,SEARCH(" ",B1)),""))
Now if this does not satisfy the requirement there is another solution, that allows to add the Date and Time Serial Numbers showing the result as “days, hours, minutes and seconds” provided that it’s acceptable to show the result in two separated cells using the following formulas:
Values with “duration” are placed in the range C4:C6,
Totals Days in cell "C10",
Total Hours in cell "C11"
Totals Days =INT(SUM($C$4:$C$6))
Total Hours =MOD(SUM($C$4:$C$6),1)
If the totals are needed for further use just use the standard "SUM" formula to add up both, see cell C13
=SUM(C10,C11)
The "original" value can be worked backwards from ZygD's formula using the following formula:
=SUM(LEFT(B1,-1+SEARCH(" ",B1)),
SUBSTITUTE(B1,LEFT(B1,SEARCH(" ",B1)),""))

Excel 2007: How to display mm:ss format not as a DateTime (e.g. 73:07)?

I need to create and Excel table that computes daily training times. each row has the following fields: Date, Distance, Time and Minutes/Km. My main problem is that I want to display the Time in format of mm:ss. For example: 24 min and 3 sec should be 24:03, but "Excel" turns it to 00:03:00 (3 min after midnight). I've tried setting up "special formatting" but still "Excel insists" on formatting the hours. More over, training may exceed 60 minutes and I still want it only as mm:ss
My second question is after I'm done with the formatting issue, what is the simple way to compute Time/Distance?
enter the values as 0:mm:ss and format as [m]:ss
as this is now in the mins & seconds, simple arithmetic will allow you to calculate your statistics
Excel shows 24:03 as 3 minutes when you format it as time, because 24:03 is the same as 12:03 AM (in military time).
Use General Format to Add Times
Instead of trying to format as Time, use the General Format and the following formula:
=number of minutes + (number of seconds / 60)
Ex: for 24 minutes and 3 seconds:
=24+3/60
This will give you a value of 24.05.
Do this for each time period. Let's say you enter this formula in cells A1 and A2. Then, to get the total sum of elapsed time, use this formula in cell A3:
=INT(A1+A2)+MOD(A1+A2,1)
Convert back to minutes and seconds
If you put =24+3/60 into each cell, you will have a value of 48.1 in cell A3.
Now you need to convert this back to minutes and seconds. Use the following formula in cell A4:
=MOD(A3,1)*60
This takes the decimal portion and multiples it by 60. Remember, we divided by 60 in the beginning, so to convert it back to seconds we need to multiply.
You could have also done this separately, i.e. in cell A3 use this formula:
=INT(A1+A2)
and this formula in cell A4:
=MOD(A1+A2,1)*60
Here's a screenshot showing the final formulas:
To make life easier when entering multiple dates/times it is possible to use a custom format to remove the need to enter the colon, and the leading "hour" 0. This however requires a second field for the numerical date to be stored, as the displayed date from the custom format is in base 10.
Displaying a number as a time (no need to enter colons, but no time conversion)
For displaying the times on the sheet, and for entering them without having to type the colon set the cell format to custom and use:
0/:00
Then enter your time. For example, if you wanted to enter 62:30, then you would simply type 6230 and your custom format would visually insert a colon 2 decimal points from the right.
If you only need to display the times, stop here.
Converting number to time
If you need to be able to calculate with the times, you will need to convert them from base 10 into the time format.
This can be done with the following formula (change A2 to the relevant cell reference):
=TIME(0,TRUNC(A2/100),MOD(A2,100))
=TIME starts the number to time conversion
We don't need hours, so enter 0, at the beginning of the formula, as the format is always hh,mm,ss (to display hours and minutes instead of minutes and seconds, place the 0 at the end of the formula).
For the minutes, TRUNC(A2/100), discards the rightmost 2 digits.
For the seconds, MOD(A2,100) keeps the rightmost 2 digits and discards everything to the left.
The above formula was found and adapted from this article:
PC Mag.com - Easy Date and Time Entry in Excel
Alternatively, you could skip the 0/:00 custom formatting, and just enter your time in a cell to be referenced of the edge of the visible workspace or on another sheet as you would for the custom formatting (ie: 6230 for 62:30)
Then change the display format of the cells with the formula to [m]:ss as #Sean Chessire suggested.
Here is a screen shot to show what I mean.
If you are using hand inputted data, you can enter your data as mm:ss,0 or mm:ss.0 depending on your language/region selection instead of 00:mm:ss.
You need to specify your cell format as [m]:ss if you like to see all minutes seconds format instead of hours minutes seconds format.
as text:
=CONCATENATE(TEXT(cell;"d");" days ";TEXT(cell;"t");" hours ";MID(TEXT(cell;"hh:mm:ss");4;2);" minutes ";TEXT(cell;"s");" seconds")
5.In the Format Cells box, click Custom in the Category list.
6.In the Type box, at the top of the list of formats, type [h]:mm;# and then click OK. (That’s a colon after [h], and a semicolon after mm.)
YOu can then add hours. The format will be in the Type list the next time you need it.
From MS, works well.
http://office.microsoft.com/en-us/excel-help/add-or-subtract-time-HA102809662.aspx
One convenient trick to entering elapsed times into Excel is to have two zeros and a colon before the number of minutes, details follow. For copy and paste operations into Excel without have to worry about formatting at all one can use the format 00:XX:XX where XX are two digits totaling < 60. In that case, Excel will echo 0:XX:XX in the cell contents displayed and store the data as 12:XX:XX AM. If one pastes data in a 00:XXX:XX format into Excel, or 00:XX:XX where either XX > 59 this will be converted into a fraction of a day.
For example, 00:121:12 becomes 0.0841666666666667, which if multiplied by the number of seconds in a day, 86,400, becomes 7272 s. Next, 00:21:12 would by default show 0:21:12 stored as 12:21:12 AM. Finally, 00:21:60 becomes 0.0152777777777778, also a fraction of a day.
This suggestion is made merely to avoid having to worry about specific formatting in Excel, and letting the program worry about it. Note, for Excel data internally formatted as 12:XX:XX AM one can only use certain Excel commands, for example, one can take an average. However, subtraction will only work when the result is a positive number. Such that converting times into seconds, fractions of a day, or other real number is suggested for access to more complete arithmetic operation coverage.
For example, if one has a column of mixed time formats, or times that are negative and will not display, if one changes the number formatting to General, all the times will be converted to fractions of a day.

Resources