+ Reply to Thread
Results 1 to 4 of 4

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 Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Help with Time

    Yes, store the date with the time, then you can easily go across midnight with a simple subtraction.

  3. #3
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    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 Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    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!)

+ 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