+ Reply to Thread
Results 1 to 6 of 6

From and To Times

  1. #1
    Registered User
    Join Date
    08-24-2007
    Location
    Florida
    Posts
    37

    From and To Times

    Row A is start time
    Row B is end time
    Row C is total time 00:00 or *24 = 0.0
    Row D is Day time 08:00 to 20:00
    Row E is Night time 20:00 to 08:00

    How to write saying calculate if A and B time is in between (8am and 8pm = day) and (8pm and 8am = night). Is it a sumif?

    So
    D = sumif whatever A and B have that's from "08:00 to 20:00"
    E = sumif whatever A and B have that's from "20:00 to 08:00"

    After that it's being *24 to get it into a decimal form to get time 00:00 to 0.0

    Thanks all!

    Edit.
    Well I guess more sense would be 08:00 - 20:00 is day and 20:01 - 07:59 is night.
    Last edited by Tdub; 07-01-2014 at 01:12 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: From and To Times

    Hi,

    Perhaps
    C1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    D1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    both copied down
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-24-2007
    Location
    Florida
    Posts
    37

    Re: From and To Times

    Cool, let me try and play around with it. Weird that the formulas would be different.?. For rows D and E?

    I've got C already as =B-$A to get the total time. Then it's just *24. I forgot why I put the dollar sign at A but it needed to be there for some reason.
    Last edited by Tdub; 07-01-2014 at 01:16 PM.

  4. #4
    Registered User
    Join Date
    08-24-2007
    Location
    Florida
    Posts
    37

    Re: From and To Times

    I like the looks of =(B1-A1)+IF(B1<A1,24,0)-D1

    But I don't know if I still understand the formula.

    Lets say

    A is 19:30 and B is 20:05.

    So C would be 00:35 or 0.6

    How would I write
    D to get 0.5
    E to get 0.1
    Last edited by Tdub; 07-01-2014 at 01:30 PM.

  5. #5
    Registered User
    Join Date
    08-24-2007
    Location
    Florida
    Posts
    37

    Re: From and To Times

    Doesn't work correctly when changing times. It's got to take in account A and B.
    And the window needs to be Max(20,0,0) Min(8,0,0) for A
    And Max(7,59,0) Min(20,1,0) for B
    Something like that?

    I've uploaded a sheet:
    Attached Files Attached Files
    Last edited by Tdub; 07-01-2014 at 04:11 PM.

  6. #6
    Registered User
    Join Date
    08-24-2007
    Location
    Florida
    Posts
    37

    Re: From and To Times

    Okay. There's a =round formula that does not work correctly because it will calculate into a negative answer where the least should be 0.0. A negative number will throw off other calculations.

    These seem to work correctly:
    =(MIN(B2,TIME(20,0,0))-MIN(A2,TIME(20,0,0)))*24 for day
    =(MAX(B2,TIME(20,0,0))-MAX(A2,TIME(20,0,0)))*24 for night

    Now the only issue to run into is lets say the time is 22:00 - 01:00 the next day.
    How to tell it to calculate realizing it's into the morning of the next day without calculating backwards. Or formatting the cells still to look like HH:MM

    So it'd be 03:00 hours total *24 = 0.3
    Day = 0.0
    Night = 3.0

    ?? Thanks for the help

+ 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. Replies: 7
    Last Post: 04-09-2014, 09:25 AM
  2. If a search term can be found 1 time, 2 times 3 times 4 times 5 times
    By excelcandy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2013, 09:57 PM
  3. [SOLVED] calculate turn around times range of times for weekday and weekend
    By xrayexceller in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-28-2013, 02:22 PM
  4. Macro Loop – Find Specific Times, Extract Date, Average Values of Times
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-25-2010, 02:50 PM
  5. [SOLVED] capture:How are relay leg times or driving times entered and totaled?
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM

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