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
I used this "array formula" in E2 confirmed with CTRL+SHIFT+ENTER and copied down
=SUM((H$2:H$7=A2)*TEXT(NETWORKDAYS(IF(I$2:I$7>C2,I$2:I$7,C2),IF(J$2:J$7
This checks that the Resource matches, and for all matching rows does a NETWORKDAYS calculation (which ignores weekends) within any overlapping date periods between leaves and tasks.
Where there is no overlap a negative value is returned so TEXT function is used to convert the negatives to zeroes.
SUM function sums the resulting array to give you the required total - see screenshot
If you want to allow blanks in the "leaves" end date field then you can use this adjusted version which will assume end date is today
=SUM((H$2:H$7=A2)*TEXT(NETWORKDAYS(IF(I$2:I$7>C2,I$2:I$7,C2),IF(IF(J$2:J$7="",TODAY(),J$2:J$7)
...or you can replace the two instances of TODAY() with another date or cell reference containing a date