May I trouble you again as I have taken this formula further? Traditionally one shows undiscounted income and costs in separate columns (see picture - columns E & F) then the sum of these two columns are discounted and shown in column G. How do I get the -3500 in F5, for example, to be discounted and shown in G5? The value in G5 would be -3299.08.
The formula in D3 is:
=LET(s,SEQUENCE(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),0)))))