Try this formula in B8 copied across to H8

=INT((WEEKDAY($E2-COLUMNS($B7:B7))+EOMONTH($E2,0)-$E2)/7)