+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : Calculating difference in times, expressing as a negative number

  1. #1
    Registered User
    Join Date
    07-06-2009
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    3

    Calculating difference in times, expressing as a negative number

    I want to calculate the difference between two columns of time: estimated and actual (minutes and seconds). Occasionally, the difference will be a negative number. I keep getting ##### as a result. An example of what I would like to achieve:

    Est. Act.
    Time Time +/-
    1:00 1:05 :05
    :35 :45 :10
    :45 :30 -:15
    :50 :40 -:10
    __________________________
    3:10 3:00 -:10

  2. #2
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Calculating difference in times, expressing as a negative number

    =IF(StartTime<EndTime,"-","") & TEXT(ABS(StartTime-EndTime),"hh:mm:ss")

    with the cell formatted as text will give 00:00:05 or -00:00:05
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating difference in times, expressing as a negative number

    Unfortunately you can't display both positive & negative time in a time format if running on 1900 date system (switching to 1904 purely for this purpose is not advised).

    So you have a few options - either

    a) store in non-time value terms by * result by 24

    C2: =24*(B2-A2)

    b) store in non-time value terms by * result by 24 & subsequently use DOLLARFR to display in time-esque format (ie 0.05)

    C2: =DOLLARFR(24*(A2-B2),60)
    Formatted to Number & 2 decimals

    c) store negative times as text, eg:

    C2: =REPT("-",B2<A2)&TEXT(ABS(B2-A2),"hh:mm")

    Option a is the most obvious as it allows for summation... though you could use A6: SUM(A2:A5) & B6: =SUM(B2:B5) and use any of the above to generate the result
    Last edited by DonkeyOte; 07-06-2009 at 12:34 PM. Reason: operator incorrect in REPT function

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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