This is very close (and awesome)! I'm not sure what you mean by "two columns match" but the only modifications I need would be:
Spectacular! Almost exactly what i was looking for.Office 365 alternative, if I understand correctly.
Code:=LET( FstDte;MAX(L9;LOOKUP(L9;F11:F18)); rDtes;EOMONTH(FstDte-1;SEQUENCE(;DATEDIF(FstDte;G18;"m"))); Periods;XLOOKUP(rDtes;G11:G18;I11:I18;;1); CHOOSE({1;2};rDtes;Periods) )
Gregg Wolin Ver 3
Could You give at once all expected details?
> You can add as many 'lease's as You have ... use same procedure.
> I added maybe Your one more missed feature above dates.
Ps. those can overlap too ( 'previous end can be later than next start' ).
.Cells(30, x) = .Cells(9, x) + i)