+ Reply to Thread
Results 1 to 7 of 7

Calculate Date from time spanning midnight

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    145

    Calculate Date from time spanning midnight

    Hi Guy's

    Is there a way of calculating the column in green automatically


    Thanks
    Attached Files Attached Files
    Last edited by AliGW; 12-28-2020 at 04:06 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,963

    Re: Calculate Date from time spanning MDT

    Given the sample data, if the end time is less than the start time, just add 1 to the start date.
    Ben Van Johnson

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,474

    Re: Calculate Date from time spanning MDT

    C3 and copied down:

    =IF(B3="","",IF(E3<D3,B3+1,B3))

    (If the End Time in Col E is earlier than the Start Time in Col D, it must be after Midnight, so Col C is date in Col B plus 1. Otherwise copy the date in Col B.)

    Obviously this only works whilst the End Time is within twenty four hours of the Start Time.
    If you want to include jobs that took more than a day you need a column to show that, so the formula can add that many days to Col B's date.

    Ochimus

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

    Re: Calculate Date from time spanning MDT

    I for one, have no idea what MDT means and don't want to waste time looking it up, so in the future please use terms in your title everybody understands. Doing so might get you faster help as members tend to answer ( or no) based on the thread title. Thanks

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,060

    Re: Calculate Date from time spanning midnight

    Agree with Pepe, and have updated the thread title with my understanding of MDT in this context. Shorthand is rarely a good idea as an opening gambit.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,474

    Re: Calculate Date from time spanning midnight

    Yippee!

    Rare chance to beat Pepe and Ali has made my Christmas!

    MDT is Mountain Daylight Time (seven hours behind the UK).

    Although given we're on this Forum, it could have been the Microsoft Deployment Toolkit or even Multi-Disciplinary Teamwork (alright, that's a slight cheat)?

    Ochimus

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,060

    Re: Calculate Date from time spanning midnight

    As the OP, like us, is in England, I am not sure about the time zone idea (but then I haven't opened the attachment) - why would a calculation need to 'span' a time zone?

    EDIT: a quick look at the attachment suggests I'm right.

+ 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. Time Calculation (Spanning Dates and using Military Time)
    By HospitalOfficer in forum Excel General
    Replies: 5
    Last Post: 07-29-2014, 12:18 PM
  2. Replies: 3
    Last Post: 12-19-2013, 06:49 AM
  3. Time spanning midnight ---- as minutes, not hh:mm
    By Hang Glider in forum Excel General
    Replies: 1
    Last Post: 01-24-2011, 06:07 PM
  4. Calculate Time Duration Spanning Different Days
    By mmjcarr in forum Excel General
    Replies: 1
    Last Post: 11-23-2009, 11:53 AM
  5. [SOLVED] calculate difference in time spanning a day, during office hours o
    By frozenfusion in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2005, 04:05 AM
  6. Replies: 1
    Last Post: 08-26-2005, 06:05 AM
  7. Time calculation (in hh.mm) spanning more than one day
    By dtencza in forum Excel General
    Replies: 8
    Last Post: 08-16-2005, 05:05 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