Script Nested Loop – Data Table in excel

3.11K viewsScripting- nested - while ; data table excel scripting

Im trying to replicate the data table functionality from excel with a while nested loop. The idea would be to populate a matrix like this:

EV is the result of EBITDA*Multiple. My idea was to define a nested while loop (2 while loops) and store the values in a matrix called MatrixEV. So I would get the full matrix shown above. I tried a script but the result is not that good.  I attach the model in case someone can give me a hand.

——Script text format—–
// Define the counters
def int y=0;
def int x=0;
// Define initial Debt and increment
def double EBITDA=10;
def double EBITDAInc=10;
// Define initial multiple and increment
def double Multiple=5;
def double MultipleInc=1;
// Define Matrix to store EV values – result of Multiple*EBITDA as defined in Matrix1
def double[][] MatrixEV= new double [5][5];
while (x<5) {
while (y<5) {
println (MatrixEV)

Answered question

Obviously not. I posted the script because the model Im working on is much more complex. A single formula does not work. I put the example to make it easier. Actually im looking for an IRR resulting from a model with 40 matrices.
thanks anyway

Answered question
You are viewing 1 out of 2 answers, click here to view all answers.