+ Reply to Thread
Results 1 to 16 of 16

Working Time With Varied Day Lengths, Excluding Weekends & Holidays

  1. #1
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Hi
    I would really appreciate some help with the following:

    I have a date range (example: 1 January 2021 09:14 to 28 February 17:23)

    excel1.JPG


    I would like to understand how I can get the elapsed time in dd-hh-mm under the following working times:

    Mondays 6am - 10pm
    Tuesdays 6am - 10pm
    Wednesdays 6am - 10pm
    Thursdays 6am - 10pm
    Fridays 6am - 4pm

    Additionally, exclusions would be weekends and selectable holidays


    Many thanks for your support
    Steve
    Last edited by st360; 01-26-2022 at 02:50 AM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Hi, time calculations are tricky
    For starters you can calculate the days using NETWORKDAYS() function where you can include the holidays to exclude, that will give you all the weekdays excluding weekends and holidays
    Next you will need to do some calculating for how many weeks that is, it will be rough but every weekday is 10 pm - 6 am (in real time numbers) except for the fridays which end a 4 pm
    Every completed week is the sum of all these hours.
    You do this for the second day untill the day before that last date
    Then you add the time worked on the starting date in your case if it's not a friday 22:00 - 09:14 and the last day is 22:00 - 17:23
    Attach a file with non private data if you want more help
    This is just to give you the idea
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Pl read yellow banner on top of this page.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Hi
    Attached is an example worksheet

    Thank you
    Attached Files Attached Files

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Will take a look later and update, am on-the-road now

  6. #6
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Great, thank you

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Pl see file with formulas.
    For days

    =IF(AND($A2=$C2,$D2-$B2=TIMEVALUE("16:00:00")),1,0)+MAX(0,NETWORKDAYS($A2+1,$C2-1,$B$8:$B$10))

    For hours

    =INT(24*(IF($A2=$C2,$D2-$B2,IF(WEEKDAY($A2,2)<6,"22:00","16:00")-$B2)+(MIN(IF(WEEKDAY($A2,2)<6,"22:00","16:00"),$D2)-"6:00")))

    For minutes

    =MOD((IF($A2=$C2,$D2-$B2,IF(WEEKDAY($A2,2)<6,"22:00","16:00")-$B2)+(MIN(IF(WEEKDAY($A2,2)<6,"22:00","16:00"),$D2)-"6:00"))*24,1)*60
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Hi kvsrinivasamurthy

    Many thanks for taking the time to have a look at this
    Unfortunately, the days are not counting correctly, the hours are going over 24 and hours are increasing over the weekend when it should be ignored

    Again, thank you
    Steve
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Give the expected answer in the file. Give the split figures how you calculate manually.
    Say Start day 15 hrs and end day has 10 hrs. Totally it is 25 hrs. Starting is Tuesday and end day is Saturday how you calculate hrs and days.

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Does this look like you expected?
    I need to add a check for the last day if it's a Friday or not
    Attached Images Attached Images

  11. #11
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Hi Keebellah

    Would it help if I kept this simpler and we just summed the number of elapsed hours
    In the attached spreadsheet, I have shown how I achieve the result

    Many thanks
    Steve
    Attached Files Attached Files

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    The result looks great if this is what you ned

  13. #13
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    For Monday you have taken as 840 Mins. Actually 6am to 10 pm ,!6 hrs. 16*60=960 Mins. How it is 840Mins?

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Taking Working Hrs As 16 hrs, Formula is

    Please Login or Register  to view this content.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    01-25-2022
    Location
    Grimsby, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Guys, this is perfect for me. I really do appreciate your help and can't describe how grateful I am


  16. #16
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Working Time With Varied Day Lengths, Excluding Weekends & Holidays

    Thanks for feedback. Pl mark the thread 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. SLA with Time and dates excluding weekends, holidays and multiple no-working hours
    By ShashankBargath in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-24-2019, 09:53 AM
  2. [SOLVED] Issues with computing the number of working days, excluding weekends/holidays
    By Vitalite in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-14-2017, 01:39 PM
  3. Replies: 13
    Last Post: 07-20-2016, 02:05 AM
  4. Replies: 5
    Last Post: 08-24-2015, 09:28 PM
  5. Replies: 0
    Last Post: 01-30-2014, 01:22 AM
  6. [SOLVED] Working Hours - excluding weekends, holidays
    By CJENKSY in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-05-2013, 02:12 AM
  7. Replies: 7
    Last Post: 06-19-2013, 05:45 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