I have 2 tables on my excel workbook. One to track tasks and one to track leave. I want to see the impact leave would have on each tasks (i.e. the total number of leave days
Apologies for late posting but this has taken a bit of thought. One way to do it is to generate an array of all the days in November, then test the array elements one at a time against each pair of leave dates to see if they fall within those dates, using countifs. So the basic formula is
=SUMPRODUCT(COUNTIFS($H$2:$H$7,$A2,$I$2:$I$7,"<="&ROW(INDIRECT($C2&":"&$D2)),$J$2:$J$7,">="&ROW(INDIRECT($C2&":"&$D2))))
However we want to ignore weekends, so to do this I set all weekend dates to zero before counting up the matches
=SUMPRODUCT(COUNTIFS($H$2:$H$7,$A2,$I$2:$I$7,"<="&ROW(INDIRECT($C2&":"&$D2))*(WEEKDAY(ROW(INDIRECT($C2&":"&$D2)),2)<=5),$J$2:$J$7,">="&ROW(INDIRECT($C2&":"&$D2))))
A fairly long formula but it seems to give the correct results.
Columns E, L and M are for checking only and are not part of the final result in column F.