+ Reply to Thread
Results 1 to 6 of 6

Calculate time up to midnight

  1. #1
    Registered User
    Join Date
    06-07-2021
    Location
    Indiana, USA
    MS-Off Ver
    MS Office 365
    Posts
    3

    Calculate time up to midnight

    I have a list of date and time stamps where I'm calculating the difference. All was well until some dates a missing. So time stamp of 8/1/2019 1:10 PM, then the next time stamp is 8/3/2019 6:30 am. The person obviously took a day off and in some instances takes 1-2 weeks off. We need to find 24 hour intervals so I'd like to find the time from 8/1/2019 1:10 PM to 8/2/2019 00:00:00. Or whatever midnight of 8/1/2019 is to Excel. Been Googling for hours and everything is end time minus start time, but having difficult figuring out how to use midnight as the end time.

    Thanks much,
    tarork

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Calculate time up to midnight

    If A1 is time stamp, i.e, "8/1/2019 1:10 PM"

    =INT(A1)+1
    is "8/2/2019 0:00"

    And different time between both time:
    =1-mod(A1,1)
    format as "hh:mm"
    Quang PT

  3. #3
    Registered User
    Join Date
    06-07-2021
    Location
    Indiana, USA
    MS-Off Ver
    MS Office 365
    Posts
    3

    Re: Calculate time up to midnight

    Thank you for the quick reply bebo021999. I'm getting .45 as the difference in midnight minus 8/1/2019 1:10 PM. I expect to see 10.83 or something like that. =INT(A1)+1 gives me 8/2/2019, but when walking through the formula, it's just 43678 not 43678.000000. I'm using the integer of date/time because in the end I create a pivot table to sum all times for one day, which should equal 24 which tells us the date time stamps are correct throughout, or we can pinpoint issues when it is not. I attached a sample file. Thanks again for your help.
    Attached Files Attached Files

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Calculate time up to midnight

    0.45 is the same as 10hrs and 50 min which seems correct to me as being the difference midnight minus 8/1/2019 1:10 PM ( to XL the underlying value for 24 hrs is 1)
    and 0.67 is the same as 16 hrs and 5 min which again is correct?
    I don't understand what is wrong?

  5. #5
    Registered User
    Join Date
    06-07-2021
    Location
    Indiana, USA
    MS-Off Ver
    MS Office 365
    Posts
    3

    Re: Calculate time up to midnight

    I got it figured out. Should be ((INT(A1)+1)-A2)*24. I was missing the function to change it to 24 hours so that I get 24 hours in the summary for each day.

    Thank you! You pointed me in the right direction.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Calculate time up to midnight

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculate Date from time spanning midnight
    By fastcar in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-28-2020, 07:19 AM
  2. Formula to calculate a time less a number of hours over midnight
    By EWolfe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-08-2020, 12:07 PM
  3. Replies: 5
    Last Post: 10-05-2019, 09:31 AM
  4. formula to calculate time difference crossing midnight
    By ditorejax in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-06-2014, 08:27 PM
  5. Replies: 13
    Last Post: 11-04-2013, 02:30 AM
  6. How to calculate night time over midnight
    By defiesta in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-06-2013, 11:05 PM
  7. Calculate time which is past midnight
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-25-2011, 12:11 PM

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