I’ve had a chance to work on this some more.
These formulas work with two assumptions:
- Since the start / end dates also have start / end times it is assumed these days are neither holidays nor Sundays
- and all days between those days are assumed to be full days (except holidays and Sundays).
This has a lookup table in I1:O5. The numbers in row 1 are the WEEKDAY numbers 1-7 Sun-Sat.
The rest of the lookup table lists the start times / end times each day and the full hours for each day minus lunch.
Holidays are listed in column O.
For convenience only there is a summary list of named ranges in H11:I15. The list has no other function. By-the-way Holidays is a Dynamic Named Range (DNR). If you are not familiar with DNRs they shrink and grow automatically as dates are deleted / added.
The formulas all refer to these named ranges.
To make it easier to explain there is a formula in F1 that allowed me to break down the final mega-formula in F2 (and F3; see below) into parts.
The parts are in F10:F13. I left them there to make reviewing easier. They only affect F1. In F2 I simply replaced the cells referenced in F1 with each of those formulas. They can be deleted when you are satisfied they work if you like, but they might make future edits and debugging easier if left.
Those formulas are … from F10 to F13 all array-entered. They are:
The final mega-formula array-entered in F2 is:
You can of course reduce this further combining terms and then multiplying.
I tested this extensively … different start / end dates … start / end times … holidays. It works.
Someone can probably simplify / shrink this further. I have been unable to do that.
If you get a chance to upgrade I would encourage it. I was surprised to find what a problem solver MODE.MULT is. It can reduce this workday / holidays calculation, but it is not available until version 2010.
Bookmarks