+ Reply to Thread
Results 1 to 17 of 17

Calculate time which is past midnight

  1. #1
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Calculate time which is past midnight

    Hi,

    This is very dumb of me but can someone tell me how to calculate time past midnight?

    Like in A1 I have 11:35 PM and in B1 I have 12:06 AM, time difference should atleast be 1 minute or 00:01 in C1.

    Regards,

    Stoey
    Last edited by stoey; 08-25-2011 at 12:12 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,111

    Re: Calculate time which is past midnight

    try =MOD(B1-A1,1)

    The difference shoudl be 31 min
    Never use Merged Cells in Excel

  3. #3
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    hi zbor,

    thanks for the reply. I also apologize for not being clear...what I would like to accomplish is that with the time difference of 00:31 minutes the display on C1 should be 00:01 which is the over limit of the given 30 minutes allowance...

    regards,

    stoey

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,111

    Re: Calculate time which is past midnight

    Maybe this:

    =B1-MAX(A1-"23:30",0)

  5. #5
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate time which is past midnight

    Perhaps
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    Hello zbor and arthur,

    I appreciate your quick response on this. I tried both of your approach. Zbor's suggestion is limited to the 23:30 time while on arthur's approach, it did work and gave me the result which is 00:01 however when the time difference for two values like 10:35 PM - 11:05 PM instead of giving me the results of 00:00 since the time difference is exactly 30 minutes, it displays ######## instead...but when the time difference is 31 minutes it gives me the correct excess value which is 00:01 or 1 minute. Sorry for being a pain here...

    Regards,

    Stoey

  7. #7
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate time which is past midnight

    In your example it should be 0.
    Are you using exact times or rounded times?
    Could the difference be smaller than 30 min?

  8. #8
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    hi arthur,

    Your question:
    In your example it should be 0.
    Are you using exact times or rounded times?
    I am using exact time
    Could the difference be smaller than 30 min?
    There is a certain limit of 30 minutes only...So if the time difference is like 00:31 minutes then it should display the excess of 1 minute from the 30 minute limit as 00:01...if the time difference is exactly 00:30 minutes then it should display as 00:00 since there is no excess of the 30 minute time limit. if the time difference is less than 00:30 minutes like 00:25 then it should still display as 00:00 or ( the word "on time" instead of 00:00 value)

    Regards,

    stoey

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,111

    Re: Calculate time which is past midnight

    Mybe this:

    =MAX(0, MOD(B1-C1,1)-"00:30")

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate time which is past midnight

    Please Login or Register  to view this content.
    works for me

  11. #11
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    Hi again zbor and arthur,

    tried both approach..
    zbor's approach keeps giving me the value 00:00 regardless if the time difference is in excess of the 30 minutes limit or not. on the other hand, arthur's approach is working however a few question here I have...this formula is good with the 30 minutes limit...how would the formula be if the limit cap is 15 minutes? has the limit cap has something to do with 1/48 on your formula arhtur? can you please provide me info so that incase i would like to change the limit cap every now and then I can set the appropriate formula...

    regards,

    stoey

  12. #12
    Registered User
    Join Date
    08-23-2011
    Location
    Exeter, England
    MS-Off Ver
    Excel 2003 (Work), 2007 (Home)
    Posts
    18

    Re: Calculate time which is past midnight

    Quote Originally Posted by stoey View Post
    has the limit cap has something to do with 1/48 on your formula arhtur? can you please provide me info so that incase i would like to change the limit cap every now and then I can set the appropriate formula...
    30 mins = 1/48 of a day

    B1 - A1 gives the difference between the two times represented as a decimal number (the decimal part being the proportion of the day)
    MOD(B1 - A1,1) discounts any full days between the two times
    IF(MOD(B1 - A1,1) <= 1/48... compares the decimal value of the difference to the decimal value of 30 mins
    Last edited by HenryCrun; 08-25-2011 at 10:16 AM.

  13. #13
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate time which is past midnight

    For XL one day =1, one hour =1/24, 1/2hr = 1/48,1/4 hr =1/96...

  14. #14
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    wow! thank you very much for all the info...I do understand now what does 1/48 mean...but how would it me if the limit cap would be like 32 minutes? how would this be in fraction?
    Last edited by stoey; 08-25-2011 at 10:24 AM.

  15. #15
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Calculate time which is past midnight

    Try 32/1440

  16. #16
    Registered User
    Join Date
    08-23-2011
    Location
    Exeter, England
    MS-Off Ver
    Excel 2003 (Work), 2007 (Home)
    Posts
    18

    Re: Calculate time which is past midnight

    Quote Originally Posted by stoey View Post
    wow! thank you very much for all the info...I do understand now what does 1/48 mean...but how would it me if the limit cap would be like 32 minutes? how would this be in fraction?
    1 hour is 1/24 day
    1 minute is 1/1440 day
    1 second is 1/86400 day

    Use the appropriate denominator, and the quantity of units as the numerator.

  17. #17
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Re: Calculate time which is past midnight

    thank you so much arthur, henry and zbor for all your assistance! you guys rock!

+ 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