+ Reply to Thread
Results 1 to 8 of 8

Formulae required to distinguish between start and end time.

  1. #1
    Registered User
    Join Date
    09-22-2012
    Location
    Nottingham, Uk
    MS-Off Ver
    Excel 2007
    Posts
    4

    Formulae required to distinguish between start and end time.

    I require a formuale that will when amending the time in either column "B" or "C" that spans past midnight eg row 52 will start to populate column"H" onwards to the respective column that has a heading equal to the time in column "C" with the number 1 or a number 0 where the time frame includes that of coolumns "D" and "E"
    I can get this to work fine up to midnight but not after midnight for example if the time start is 22:00 and end time is 06:15 my formuale only works to 00:00

    Hope this makes sense ?
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: Formulae required to distinguish between start and end time.

    The underlying issue is that both dates and times are numbers which must be formatted to look like dates and times.
    Times are decimal fractions of a day which reset at midnight.

    Consider that the underlying numeric value of this moment is 42066.0642155093. Formatted for date and time is 3/3/2015 1:32 AM. The integer part is the date. The decimal the time.

    One way of overcoming the math dilemma when computing times spanning midnight is to include the date also. That way subtracting 11:00 PM yesterday which would have been 42065.9583333333 from the above date / time we can reconcile the trans-midnight problem. It would correctly yield 0.109724652778823 which when formatted for hours and minutes (hh:mm) would be 02:38 or 2 hours and 38 minutes.

    Does this help?

    BTW day 1 is 1/1/1900.

    Another BTW. When I did the subtraction above I was referencing a date / time generated by the NOW() function. It is volatile and when I did the subtraction time had advanced a few minutes.
    Last edited by FlameRetired; 03-03-2015 at 03:49 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Formulae required to distinguish between start and end time.

    Good clean explanation FlameRetired! Vince, Flame is absolutely right in saying that the best way to set this up is with the date to avoid a complicated mess.

    I have not opened your sheet to look at your layout, but the logic that goes in place without dates (Again not recommended) would be as follows.
    Please Login or Register  to view this content.
    While that is a simplistic illustration of how to achieve it without a date, the more variables the more it gets complicated and many tend to get lost in logic.

    Cheers
    -If you think you are done, Start over - ELeGault

  4. #4
    Registered User
    Join Date
    09-22-2012
    Location
    Nottingham, Uk
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Formulae required to distinguish between start and end time.

    Many thanks for your help Flame as a relative newcomer to Excel this is invaluable
    Kind Regards
    Vince

  5. #5
    Registered User
    Join Date
    09-22-2012
    Location
    Nottingham, Uk
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Formulae required to distinguish between start and end time.

    Many thanks for your kind assistance it is much appreciated

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,430

    Re: Formulae required to distinguish between start and end time.

    You are very welcome.

  7. #7
    Registered User
    Join Date
    01-30-2013
    Location
    Hobart, TAS
    MS-Off Ver
    Office 2003, XL2007
    Posts
    46

    Re: Formulae required to distinguish between start and end time.

    A1 is Start time (with or without Start date)
    B1 is Finish time (if A1 with date B1 must have Finish date)
    C1 =IF(A1>B1,(1+B1),B1)-A1 format as [h]:mm

  8. #8
    Registered User
    Join Date
    09-22-2012
    Location
    Nottingham, Uk
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Formulae required to distinguish between start and end time.

    Thanks very much for your concise and clear assistance. Many thanks.

+ 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] Formulae required for serial number
    By accountant. in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-20-2013, 01:05 PM
  2. Replies: 0
    Last Post: 07-17-2012, 10:11 AM
  3. Replies: 3
    Last Post: 03-27-2012, 01:07 PM
  4. excel formulae required
    By vmprakash in forum Excel General
    Replies: 2
    Last Post: 09-03-2010, 03:28 AM
  5. Excel 2007 : Formulae required for a stock report
    By lindalou in forum Excel General
    Replies: 4
    Last Post: 04-21-2009, 08:14 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