Home » excel » iteration – Excel – Output results of a calculation from multiple inputs

iteration – Excel – Output results of a calculation from multiple inputs

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have a spreadsheet which I am using to design a Linear Fresnel Collector:

Basically, it has cells which you can input the parameters of the design, e.g. number of mirrors, width of mirror. Then it gives me other parameters back e.g. length concentration, ratio, etc. The calculations (and the spreadsheet) are sufficiently complicated that it is impractical to change the cells, record the outputs, change the cells, etc.

What I want to do is compare many different combinations of mirror width and number of mirrors. (say 2 input cells, 6 output cells).

Is there a way to get excel to produce one large table with results iterating over both parameters without having to do it manually? The speadsheet it too complicated to just put each variable in a column and drag down.

Link to a picture of the spreadsheet:

http://i.stack.imgur.com/Sjraw.png

P.S. I don’t know any VB, so a solution that doesn’t require would be great

How to&Answers:

You might be able to make use of one or more data tables (introduced in Excel 2007), although I’m not sure how well it would work when you’re looking to capture multiple output values. Maybe create one table for each output?

Answer:

Easiest way to achieve this – although not necessarily pretty in terms of layout – is to put all your calculations into a single column or row, and simply repeat the column/row with your variables changing per row/column.

Answer:

If those are the only parameters you’re interested in iterating over, the solution is simple but not pretty. (It won’t be formatted nicely like you have it in the screenshot.)

What you should do, is in another worksheet, duplicate the formulas in question so that each parameter is in its own column. Then in each of the result columns, copy and paste the formula into as many cells as you want (you can also do this by dragging the corner of one cell down a column). What this does is it copies the formula, but shifts the cell references down with the new cell. For example, if I had A1 and B1 changed manually, and C1 = A1+B1, after copying and pasting, I would have C2 = A2+B2, C3 = A3+B3, etc.

If you want one cell reference to stay put, put dollar signs in front of the letter and number. So if that formula from above was C1 = $A$1 + B1, then after copying and pasting I would have C2 = $A$1 + B2, C3 = $A$1 + B3, etc.

Now, the only thing to do is automatically input a range of values into the input columns. Let’s assume you’re using column A. Put an initial value into A1 manually, then in A2 put A2 = A1 + (increment value). Now copy and paste A2 down as far as you want, and you’ll get A3 = A2 + (increment value), A4 = A3 + (increment value), etc.