Reputation: 13
I searched through internet and came up with nothing. I have two tables. one includes work dates and the other has vacation dates. I have to find the intersected dates.
Let me give an example;
Work Table
1| A | B | C | D
2|Person | Work Start Date | work finish Date |Intersected Vacations
3|Mike | 01.08.2013 | 10.08.2013 |1 (Needed to find)
4|John | 16.08.2013 | 25.10.2013 |3 (Needed to find)
Vacations Table
1|A |B |C
2|Person |Vacation Start Date |Vacation End Date
3|Mike | 05.08.2013 | 05.08.2013
4|John | 20.09.2013 | 21.09.2013
5|John | 01.10.2013 | 01.10.2013
So, I need an excel formula to calculate the vacations between the work days.
Upvotes: 0
Views: 235
Reputation: 46341
Assuming you are counting all days within the periods, including Saturdays and Sundays you can use this "array formula" as per my screenshot below:
Formula is as follows in D3:
=SUM(IF(A$8:A$10=A3,IF(C$8:C$10>=B3,IF(B$8:B$10<=C3,IF(C$8:C$10>C3,C3,C$8:C$10)-IF(B$8:B$10<B3,B3,B$8:B$10)+1))))
confirmed with CTRL+SHIFT+ENTER and copied down to D4
This may look like overkill for your small example but I'm assuming your real data is larger - this solution can be extended as required, even for multiple unsorted vacation periods
Upvotes: 1