I'm having trouble writing this program. I want to define a 2-D array, let's call it Cube. The dimensions of the array should be dependent upon an input called Number. Such that, the dimensions of the array Cube should be Cube(0 to Number, 0 to Number).

I would like Cube(0,0) to be set to another input, Starter. From here, I would like the rest of the array to be calculated from this starting point. The whole top row should be calculated as the previous number multiplied by input X. So

Cube(1,0) = Cube(0,0)*X

Cube(2,0) = Cube(1,0)*X

Cube(3,0) = Cube(2,0)*X

And so on.

Starting with the 2nd row, the rest of the array should be calculated by multiplying the number above and to the left by another input Y. For example:

Cube(1,1) = Cube(0,0)*Y

Cube(2,1) = Cube(1,0)*Y

Cube(2,2) = Cube(1,1)*Y

Cube(3,1) = Cube(2,0)*Y

And so on...

Once all the values are defined, I would like to change the values of any numbers below input Z to 500. For example, if Cube(56,42)< Z, then the value of Cube(56,42) will be changed to equal 500.

Finally, I want to work back from the right-most column to get back to the starting point of Cube(0,0). If the array's dimensions ended at 100, then:

If Cube(99,0)=500, then keep it as 500,

Else Cube(99,0)=Cube(100,0)*A + Cube(100,1)*B

For the sake of repetition:

If Cube(68,54)=500, then keep it as 500,

Else Cube(68,54)=Cube(69,54)*A + Cube(69,55)*B

It should keep working backwards until it gets the value for Cube(0,0). I would like the function to then give this number as its output. This is pretty complicated, but I know there's a lot of excel geniuses on this forum. Any help would be extremely appreciated. Thank you.