+ Reply to Thread
Results 1 to 4 of 4

Thread: Time

  1. #1
    Registered User
    Join Date
    02-16-2010
    Location
    Des Moines, Iowa
    MS-Off Ver
    Excel 2003
    Posts
    1

    Time

    I need to compare actual time to a deadline and calculate the minutes early or late - and across midnight. For example; if the deadline is 11:50 pm and the actual is 11:55 pm the result is 5 minutes late, if the actual is 11:45 pm it's 5 minutes early. Where I'm having trouble is when the deadline is 11:50 pm and the actual time is 12:05 am (15 minutes late). I've tried several formulas (see below) but none will work uniformly across all three situations. Can someone offer a suggestion?

    Some formulas that work some of the time (but not all):

    =B1+(A1>B1)-A1
    =B1-A1+(b1<A1)
    =B1-A1+IF(A1>B1,1)

    ?? Thanks...

  2. #2
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,036

    Re: Help with Time

    Yes, store the date with the time, then you can easily go across midnight with a simple subtraction.
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  3. #3
    Forum Guru darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Colorado, US
    MS-Off Ver
    2007
    Posts
    2,140

    Re: Help with Time

    If there's not more than a day's difference ever, you can use =Mod(B1-A1,1)

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,225

    Re: Help with Time

    Format the cell as General and put in this formula:

    =((B1-A1) + (A1>B1)) * 1440
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

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.2.0