Something like this should work as long as the Start Date and End Date share the same year:
=IF(OR(COLUMNS($F$2:F2)<MONTH($D2),COLUMNS($F$2:F2)>MONTH($E2)),"",NETWORKDAYS(MAX(DATE(YEAR($D2),COLUMNS($F$2:F2),1),$D2),MIN(EOMONTH(DATE(YEAR($D2),COLUMNS($F$2:F2),1),0),$E2)))
The formula compares the number of columns to the month number and when they overlap it calculates the number of working days from MAX(Start of Month, Start Date) to the MIN(End of Month, End Date).
If the month names were actual dates (for example the first of the month) the whole formula could be a lot easier to write (you could compare one date to another) and it would work even if the leave started at the end of one year and ended the next year.