Robert Davidson
New Member
- Joined
- Aug 8, 2023
- Messages
- 29
- Office Version
- 365
- Platform
- Windows
- MacOS
I am looking for some help with an array formula. In cells P3 to Y3 I have the following formula which works perfectly:
=LET(yr,SEQUENCE(ModDurn,,StYr),
cost1,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D11*(NPE+NPMY1),0))),0),
cost2,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+1,OR(y<=D14,D14=0)),D11*NPMY2,0))),0),
cost3,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+2,OR(y<=D14,D14=0)),D11*NPMY3,0))),0),
cost4,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+3,OR(y<=D14,D14=0)),D11*NPMY4,0))),0),
sfcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D3*SF,0))),0),
dfcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D4*DF,0))),0),
ofcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D5,0))),0),
HSTACK(cost1+cost2+cost3+cost4+sfcost+dfcost+ofcost))
I am totalling these columns in cell Z3 with this formula which again works perfectly:
=HSTACK(P3#+Q3#+R3#+S3#+T3#+U3#+V3#+W3#+X3#+Y3#)
I would like to change the first formula to introduce another calculation of the same information (adding in dcost1 to dofcost - see below) and summarise that in a new total under NPV total (column AA) similar to the HSTACK above.
How do I get the sum of the second section of the first formula (from dcost1 to dofcost) into a new column under NPV total (column AA)?
=LET(yr,SEQUENCE(ModDurn,,StYr),
cost1,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D11*(NPE+NPMY1),0))),0),
cost2,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+1,OR(y<=D14,D14=0)),D11*NPMY2,0))),0),
cost3,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+2,OR(y<=D14,D14=0)),D11*NPMY3,0))),0),
cost4,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2+3,OR(y<=D14,D14=0)),D11*NPMY4,0))),0),
sfcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D3*SF,0))),0),
dfcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D4*DF,0))),0),
ofcost,IFERROR(-BYROW(yr,LAMBDA(y,IF(AND(y=D2,OR(y<=D14,D14=0)),D5,0))),0),
HSTACK(cost1+cost2+cost3+cost4+sfcost+dfcost+ofcost))
I am totalling these columns in cell Z3 with this formula which again works perfectly:
=HSTACK(P3#+Q3#+R3#+S3#+T3#+U3#+V3#+W3#+X3#+Y3#)
I would like to change the first formula to introduce another calculation of the same information (adding in dcost1 to dofcost - see below) and summarise that in a new total under NPV total (column AA) similar to the HSTACK above.
How do I get the sum of the second section of the first formula (from dcost1 to dofcost) into a new column under NPV total (column AA)?