+ Reply to Thread
Results 1 to 7 of 7

Subtract two times (incl. holidays and excl. weekends)

  1. #1
    Registered User
    Join Date
    02-01-2014
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    61

    Subtract two times (incl. holidays and excl. weekends)

    I am trying to subtract two times from either and the purpose is to know the difference between the two times within an operational work day (what I have called "vacation" on the attachment).

    I have tried several formulas which include WORDAYS and NETWORKDAYS.INTL but cannot figure it out. I do not think workdays is appropriate as the clock should roll 24/7 in exception to what is stated within the 'vacation table'.

    subtract two times with holidays.xlsx

    Please see the attachment. If you find the right formula your Column C should equal my Column D. The 'vacation table' will not always be 24 hours.
    Last edited by blens1; 08-06-2015 at 10:40 PM. Reason: Updated attachment

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Subtract two times (incl. holidays and excl. weekends)

    in rows 17 and below, why are you adding 2 hours?
    Start time is after the start of vacation so I thought the formula should return 0 but you seems to add 2 hours.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-01-2014
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Subtract two times (incl. holidays and excl. weekends)

    subtract two times with holidays.xlsx

    You are correct that row 17 and after is wrong. I have attached an updated version

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

    Re: Subtract two times (incl. holidays and excl. weekends)

    This formula works through row 16.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    After that it returns numbers different than the expected results.

    From row 17 downward I cannot see how you come up with the values you do. Can you clarify further?

    BTW: Both files appear to be identical.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    5
    Start Time
    End Time
    Formula
    What it should be
    (1.0 = 1 Day)
    Start of Vacation
    End of Vacation
    6
    7/30/15 10:00
    7/31/15 8:50
    0.95
    0.95
    8/1/15 2:00
    8/2/15 2:00
    7
    7/30/15 11:50
    7/31/15 8:15
    0.85
    0.85
    8
    7/31/15 3:40
    7/31/15 8:20
    0.19
    0.19
    9
    7/31/15 3:43
    7/31/15 9:17
    0.23
    0.23
    10
    7/31/15 4:29
    7/31/15 10:45
    0.26
    0.26
    11
    7/31/15 4:35
    7/31/15 12:30
    0.33
    0.33
    12
    7/31/15 7:26
    7/31/15 10:50
    0.14
    0.14
    13
    7/31/15 10:27
    7/31/15 13:05
    0.11
    0.11
    14
    8/2/15 5:01
    8/2/15 8:35
    0.15
    0.15
    15
    7/31/15 21:27
    8/2/15 10:15
    0.53
    0.53
    16
    7/31/15 16:17
    8/2/15 8:51
    0.69
    0.69
    17
    8/1/15 5:53
    8/2/15 12:10
    0.42
    0.51
    18
    8/1/15 5:53
    8/2/15 10:50
    0.37
    0.45
    19
    8/1/15 8:35
    8/2/15 13:45
    0.49
    0.57
    20
    8/1/15 10:16
    8/2/15 14:05
    0.50
    0.59
    Last edited by FlameRetired; 08-07-2015 at 01:42 AM. Reason: show outcomes
    Dave

  5. #5
    Registered User
    Join Date
    02-01-2014
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    61
    You might be correct that row 17 and below don't work but I need this formula to be automatic as the real goes 200 rows deep and I prefer for it not to be that long. There has to be an easier way.



    Quote Originally Posted by FlameRetired View Post
    This formula works through row 16.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    After that it returns numbers different than the expected results.

    From row 17 downward I cannot see how you come up with the values you do. Can you clarify further?

    BTW: Both files appear to be identical.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    5
    Start Time
    End Time
    Formula
    What it should be
    (1.0 = 1 Day)
    Start of Vacation
    End of Vacation
    6
    7/30/15 10:00
    7/31/15 8:50
    0.95
    0.95
    8/1/15 2:00
    8/2/15 2:00
    7
    7/30/15 11:50
    7/31/15 8:15
    0.85
    0.85
    8
    7/31/15 3:40
    7/31/15 8:20
    0.19
    0.19
    9
    7/31/15 3:43
    7/31/15 9:17
    0.23
    0.23
    10
    7/31/15 4:29
    7/31/15 10:45
    0.26
    0.26
    11
    7/31/15 4:35
    7/31/15 12:30
    0.33
    0.33
    12
    7/31/15 7:26
    7/31/15 10:50
    0.14
    0.14
    13
    7/31/15 10:27
    7/31/15 13:05
    0.11
    0.11
    14
    8/2/15 5:01
    8/2/15 8:35
    0.15
    0.15
    15
    7/31/15 21:27
    8/2/15 10:15
    0.53
    0.53
    16
    7/31/15 16:17
    8/2/15 8:51
    0.69
    0.69
    17
    8/1/15 5:53
    8/2/15 12:10
    0.42
    0.51
    18
    8/1/15 5:53
    8/2/15 10:50
    0.37
    0.45
    19
    8/1/15 8:35
    8/2/15 13:45
    0.49
    0.57
    20
    8/1/15 10:16
    8/2/15 14:05
    0.50
    0.59

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

    Re: Subtract two times (incl. holidays and excl. weekends)

    I'll see what I can do. Can you accommodate helper columns / cells?

    Edit: I can not come up with anything else. I am calling for help.

    Another edit: This is slightly shorter. Array-enter and fill down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you aren’t familiar with array-entered formulas array enter means the formula must be committed by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Last edited by FlameRetired; 08-09-2015 at 04:17 PM.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Subtract two times (incl. holidays and excl. weekends)

    The array function offered above seems to operate perfectly. I would recommend you use that.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. hour difference between two dates/times, exclude weekends and holidays
    By lamdl in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-23-2014, 09:11 PM
  2. Replies: 7
    Last Post: 06-19-2013, 05:45 AM
  3. [SOLVED] Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays
    By randers1984 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-15-2013, 10:24 AM
  4. Replies: 2
    Last Post: 03-02-2013, 10:57 AM
  5. Replies: 2
    Last Post: 10-24-2012, 02:37 PM
  6. Replies: 5
    Last Post: 05-18-2012, 10:24 AM
  7. Replies: 1
    Last Post: 06-04-2009, 03:43 PM
  8. Subtract day and time w/o weekends or holidays
    By kajero in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-11-2008, 07:56 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