Robert, you can try the below formula :
=LET(s,SEQUENCE(IF((B2+B3)>B7,B7-B2+1,B3),,B2),HSTACK(s,BYROW(s,LAMBDA(y,IF(AND(y>=B6,IF(ISBLANK(B7),B2+B3,y<=B7),MOD(y-B6,B4)=0),B5,0))),BYROW(s,LAMBDA(y,IF(AND(y>=B6,IF(ISBLANK(B7),B2+B3,y<=B7),MOD(y-B6-B9,B4)=0),-B8,0))),BYROW(s,LAMBDA(y,IF(AND(y>=B6,IF(ISBLANK(B7),B2+B3,y<=B7),MOD(y-B6,B4)=0),ROUND(B5/(1+B11)^(y-B2),2),IF(AND(y>=B6,IF(ISBLANK(B7),B2+B3,y<=B7),MOD(y-B6-B9,B4)=0),ROUND(-B8/(1+B11)^(y-B2),2),0))))))
I am not clear on the relationship between the last note (effectively "cut cashflow in 2100") and cell B3 (Model duration = 1000).
Does B3 mean the table goes for 1000 rows? Seems very long!!?
If so, does B7 mean that income stops in 2100 but costs continue for the whole 1000 rows?
Peter, Sorry I wasn't that clear. Discounting and working out nett present value (the sum of the discounted column) requires long time frames to ensure the values in the discounted column eventually turn to zero. I should really re-label B7 to be last income and last costs. The reason I need to cut cost and income at some point in the future is that a block of trees might be being felled and replanted as normal then the landuse is changed for that block to be, for example, a wind farm (as happens here in the UK). Thus income and costs associated with forestry stop. Hopefully that makes sense.