Assuming the description is binding, while sample data is "loosy" - like 30 written in E3, E4 for May (31 days long) or H2 and H4 - august is also 31 days long but in H3 shall be 30, because end date (C3 is Aug 30th):
Formula for D2 and copy down/right:
Formula:![]()
=MAX(0,1+MIN($C2,EOMONTH(D$1,0))-MAX($B2,D$1))
Bookmarks