+ Reply to Thread
Results 1 to 7 of 7

Help with time duration formula..

Hybrid View

  1. #1
    Registered User
    Join Date
    10-18-2006
    Posts
    5
    EDIT~

    =Q2-P2+(Q2<A2)

    where:
    A2 = some date, say 12/10/2006
    P2 = 23:50
    Q2 = 01:10

    value would be 01:10, whereas using 01:00 and 02:00 would result in 25:00 instead of 01:00 that i'm aiming for. i'd still like to use a single formula for each duration cell (i'm putting together a form for mass usage). also, i'm not familiar with combining several arguments into one formula (apologies :x)
    Last edited by amper; 12-27-2006 at 06:10 PM.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by amper
    EDIT~

    =Q2-P2+(Q2<A2)

    where:
    A2 = some date, say 12/10/2006
    P2 = 23:50
    Q2 = 01:10

    value would be 01:10, whereas using 01:00 and 02:00 would result in 25:00 instead of 01:00 that i'm aiming for. i'd still like to use a single formula for each duration cell (i'm putting together a form for mass usage). also, i'm not familiar with combining several arguments into one formula (apologies :x)
    =Mod( your calculation ,1)

    for you

    =Mod((Q2-P2+(Q2<A2)),1)

    ----
    Si fractum non sit, noli id reficere.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702
    Quote Originally Posted by amper
    EDIT~

    =Q2-P2+(Q2<A2)

    where:
    A2 = some date, say 12/10/2006
    P2 = 23:50
    Q2 = 01:10
    You're using the wrong formula

    Assuming Q2 just contains a time and A2 a date then Q2 will always be less than A2 so your formula is the same as

    =Q2-P2+1, which, as you've discovered, will give you the wrong result whenever the shift doesn't cross midnight.

    You should use

    =Q2-P2+(P2>Q2)

    or

    =MOD(Q2-P2,1)

  4. #4
    Registered User
    Join Date
    10-18-2006
    Posts
    5
    thanks very much.. that was much cleaner than all the round about ways i thought up. cheers

+ 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