+ Reply to Thread
Results 1 to 8 of 8

Adding a series of duration times

  1. #1
    Registered User
    Join Date
    07-23-2008
    Location
    New Zealand
    Posts
    4

    Adding a series of duration times

    Hi folks,
    I'm trying to solve a problem which should be incredbly easy.
    I want excel to add a column of duration times (expressed in hours, minutes and seconds) to give me the total duration time.

    Times should be entered in column A and automatically converted to hours, minutes and seconds. E.g. entering 12233 should automatically convert to 1:22:33 to represent 1 hour, 22 minutes and 33 seconds. I then want all the duration times entered in column A to be added to give me a total duration time. I have tried all kinds of formatting option and excel keeps spitting dates back at me. I do not want dates or actual times of day to be referred to anywhere in the spreadsheet. The spreadsheet I need deals only with duration times.

    Can someone please help.

    Thanks in advance.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    It would be better if you entered your time values as time values hh:mm:ss with a semi-collon between the numbers then you could sum them with a cell formatted as [hh]:mm:ss to give a total time.

    If you do enter your time as 12233, then you could do a custom format like this 00":"00":00, but the underlying figure would still be a number not a time value, then the problems come with adding to give a total time.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695
    You can't do that with cell formatting alone. Are you happy to use some code, I could point you in the direction of a "change event" which would automatically convert the data as you enter it?

    Otherwise you could convert with a formula in the next column, i.e.

    If you enter data in A1 as 12233

    Then this formula in B1 will convert it to 1:22:33

    =TEXT(A1,"00\:00\:00")+0

    You can then just sum column B. Make sure you format the total cell as [h]:mm:ss

  4. #4
    Registered User
    Join Date
    07-23-2008
    Location
    New Zealand
    Posts
    4
    Quote Originally Posted by daddylonglegs View Post
    You can't do that with cell formatting alone. Are you happy to use some code, I could point you in the direction of a "change event" which would automatically convert the data as you enter it?
    Sorry about the very late reply. I'm a bit of a beginner but I'm happy to learn how to use some code. Could you point me in the direction of the "change event" to do the automatic conversion?

    Cheers

  5. #5
    Registered User
    Join Date
    12-01-2008
    Location
    Scotland
    Posts
    3
    Quote Originally Posted by daddylonglegs View Post
    You can't do that with cell formatting alone. Are you happy to use some code, I could point you in the direction of a "change event" which would automatically convert the data as you enter it?

    Otherwise you could convert with a formula in the next column, i.e.

    If you enter data in A1 as 12233

    Then this formula in B1 will convert it to 1:22:33

    =TEXT(A1,"00\:00\:00")+0

    You can then just sum column B. Make sure you format the total cell as [h]:mm:ss
    Hi Folks!
    This is my first post, so I hope I'm doing it right
    I was fascinated by the above conversion formula.
    =TEXT(A1,"00\:00\:00")+0
    What purpose do the forward slashes(\) serve and also why the final "+0"?
    Thank you
    Hope I've done this right.
    shalom
    Auto

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695
    The \ tells excel that the next character - the : should be treated as literal text, so without the +0 the formula

    =TEXT(A1,"00\:00\:00")

    will convert 123456 to a text string "12:34:56".....but that's still a text string so we want to convert it to the actual time. You can co-erce a text formatted number (or time, or date) to be an actual number by performing a mathematical operation on it, so we use one that doesn't change the value, e.g. +0 or *1 or preceding with --, i.e.

    =--TEXT(A1,"00\:00\:00")

    This converts to the number that represents the time 12:34:56, you then have to re-format the cell to show as a time

  7. #7
    Registered User
    Join Date
    12-01-2008
    Location
    Scotland
    Posts
    3
    Thanks for that Daddylonglegs
    A timely and informative answer.
    The more I learn about Excel the more I realise that I know bu44er all.(preceded by -- Who'da thunk?)
    Thanks again
    Auto

  8. #8
    Registered User
    Join Date
    03-30-2009
    Location
    Charlotte, NC
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Adding a series of duration times

    This was a GREAT and easy to understand to a problem I've been struggling with all weekend. I joined to forum to ask a question but found this after a simple search. Thank God for you young guys who know this stuff inside and out. ronb.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1