+ Reply to Thread
Results 1 to 16 of 16

Total Possible Hours Worked Between Dates

  1. #1
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Total Possible Hours Worked Between Dates

    Hello,

    Is it possible to calculate total possible hours an employee can work between dates based on shift schedule and excluding Holidays?

    I have a start date/time in cell B6 and end date/time in cell C6 and would like the result in cell D6 please.

    I also listed this years holidays. Can this be dynamic based on the year in cell I5?

    Thank you very much for your help,
    XJ

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Here's how I would do this:

    Put Sunday through Saturday in cells C21:C27
    Use this formula in D21 then drag through D27: =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(B$6&":"&C$6)))=ROWS($1:1)))
    Use this formula in E21 then drag through E27: =IFERROR((E10-B10-D10+C10)*24,0)
    Use this formula in F21 then drag through F27: =COUNTIFS(H:H,">="&B$6,H:H,"<="&C$6,J:J,C21)

    Now you can use a simple SUMPRODUCT formula in D6:
    =SUMPRODUCT(D21:D27-F21:F27,E21:E27)

    You can put this "helper" area wherever you'd like including on another hidden sheet.

    See attached workbook.
    Attached Files Attached Files

  3. #3
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    That works thank you. I forgot to list company days off.

    The Friday after Thanksgiving is one and there will be a Christmas break too.

    Any ideas please?

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    You're welcome. Because there are 4 Sundays between 11/1/2018 and 11/29/2018.

  5. #5
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    Sorry I realized the number of Sundays and edited my previous reply.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Just saw your edit to post #3.

    If you list the company days off with the holidays, the formulas will treat those days the same as holidays.

    Then you can change F20 to something like "Company Days Off" or whatever works for you.
    Last edited by 63falcondude; 11-16-2018 at 01:04 PM.

  7. #7
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    Great that is awesome thanks.

    The second part of my question is to list the holidays by year is that possible?

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Thanks for the rep!

    I'm not sure what you mean. Do you mean if you were to change I5 to 2019, the 2019 holidays would show in columns H:J?

  9. #9
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    Yes that is what I mean. I tried adding what the company days off are for this year and your method works great.

    The day after Thanksgiving is easy for it is the day after.

    Our company Christmas break is determined by when Christmas day falls. I put this year's days off but next year I will have to manually enter them I guess.

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    I have an idea. You will have to have a list of all holidays and company days off (for all years) that you can put in a separate sheet and then pull from there. Give me a few minutes.

  11. #11
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    On another note if you can please.

    How can I add up the hours in F10 thru F17? Does it have to do with formats?

  12. #12
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    I put a table of all holidays on Sheet2 with copied/bogus 2019 dates just to test with.

    H7 =IFERROR(INDEX(Holidays!A:A,SMALL(IF(YEAR(Table1[Date])=$I$5,ROW(Table1[Date])),ROWS($1:1))),"") Ctrl Shift Enter

    Drag the formula through J7 then down as far as needed.

    Now when you change I5 to 2019, the list will automatically adjust as will the other formulas.
    Attached Files Attached Files

  13. #13
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Quote Originally Posted by xjohnson View Post
    On another note if you can please.

    How can I add up the hours in F10 thru F17? Does it have to do with formats?
    F10 =IFERROR((E10-D10+C10-B10)*24,0)

    Drag down through F16 and change the format to General.

  14. #14
    Banned User!
    Join Date
    10-12-2018
    Location
    Texas
    MS-Off Ver
    2010
    Posts
    358

    Re: Total Possible Hours Worked Between Dates

    I really appreciate the help this system is great!


  15. #15
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Happy to help!

    Now that we have a table with all of the company days off, I would refer to that in the F21 formula.

    =COUNTIFS(Table1[Date],">="&B$6,Table1[Date],"<="&C$6,Table1[Day of Week],C21)

    Without getting to deep into the why (I can if you'd like), this works better.

  16. #16
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Total Possible Hours Worked Between Dates

    Thanks for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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] Formula to calculate hours worked w/lunch or w/o + OT column only total after 40 hours
    By blinhart in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2023, 11:14 AM
  2. [SOLVED] Total Hours Worked
    By Billy Spivy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-06-2018, 09:51 AM
  3. [SOLVED] Total hours worked each day
    By ~TaC~ in forum Excel General
    Replies: 15
    Last Post: 02-26-2018, 01:02 PM
  4. Replies: 2
    Last Post: 02-11-2013, 02:26 PM
  5. Replies: 4
    Last Post: 06-26-2012, 02:19 AM
  6. Replies: 6
    Last Post: 05-03-2010, 12:03 PM
  7. total of hours worked
    By carolynkeene in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2006, 03:29 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