• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find work hours from 2 dates, exclude weekends (sat & sun), exclude stat holidays, exclude partial h

Ria

Member
Hi all:
I am trying calculate number of hours in C5 from two dates with time (A5 = Start date: 04/09/2014 12:00:00 PM & B5 = End date: 05/09/2014 16:00:00 PM).
Requirements:
Regular work hours are 9:00 am to 4:00pm( 9:00 to 16:00 hours)
It should exclude start hour and end hour (only calculate hours between hours mentioned in dates ( e.g. Sep 4, 2014 12:00PM & Sep 5, 2014 16:00, it should count between 12:00 & 16:00 and give me 3 hours, NOT 4 hours.).
It should exclude weekends (sat & sun)
It should exclude stat holidays. I have list of stat holidays in sheet Holidays in column A
It should consider half days work hours which are listed in sheet Holidays column F & G (9:00 to 13:00). I will keep this list in case we change these hours. And Half work days dates are listed in sheet Holidays, column F. I will keep adding/change these dates because every year dates changes like around christmas or so. Basically list will grow like stat holidays list.
I have formula in C5 (copied from elsewhere) but unable to manage it. How to exclude stat holidays and half work days.

2. Second formula I have in F11, read last date/max date from colum B5:B45 (e.g. last date: Nov 20, 14 12:00:00 PM). Then add number of hours from E11 and give me future date and time.
Requirements:
Regular work hours are 9:00 am to 4:00pm( 9:00 to 16:00 hours)
It should exclude weekends (sat & sun)
It should exclude stat holidays. I have list of stat holidays in sheet Holidays in column A
It should consider half days work hours which are listed in sheet Holidays column F & G (9:00 to 13:00). I will keep this list in case we change these hours. And Half work days dates are listed in sheet Holidays, column F. I will keep adding/change these dates because every year dates changes like around christmas or so. Basically list will grow like stat holidays list.
My formula is working now but unable to handle stat holidays and half work day dates.
I do not know if these formulas can be done just in excel or we need vba code. I spent enough time to figure out the solution and burn my mind. Finally decided to ask gurus.

Hopefully, someone will help.

Attached is sample worksheet. Using excel 2003.

Thanks

Ria
 

Attachments

  • Test.xls
    56.5 KB · Views: 7
Hi. You can use to "NETWORKDAYS.INTL"
My sample is atteched. Using excel 2013

Thanks Yildiz.
Your solution seems good. But in my worksheet HOURS, it will be continuous addition of data. I do not know how to fit your solution into that. Plus I am not that expert. I opened it in excel 2007, it shows me result then it turned to errors #name or so. Sory, I thought there could be solution in excel 2003.

Regards

Ria
 
Back
Top