"Unnesting" a formula

oyvindstrand

New member
Joined
Dec 13, 2014
Messages
1
Reaction score
0
Points
0
Hi,


I've just spent a lot of time creating a sheet with many levels of temporary results, these temporary results I've saved in cells. The calculation depends on different parameters that the user enters into other cells.


For example


A1 10 (entered by user)


B1 =A1+5 (temporary result level 1)


C1 =(B1 + 2)/2 (temporary result level 2)


D1 =C1 ( (8,5) final result level 3)


Of course my real sheet has closer to 20 levels and many more parameters otherwise I wouldn't have a problem which is this:


I want to automatically go through a range of values for A1 and then put the result from D1 in another range of cells. My thought was to just write a VBA function, put this function in the formula field of a cell and choosing the input cells by clicking on them. When executing this function it should set the value of A1 which would make the sheet compute the value of D1. Then using autofill i could just copy this formula, this would take the range of input values automatically and produce a range of output values, also automatically.


But after I've spent many hours creating the sheet I found out that you can't use a VBA function to change the value of other cells than the one it's called from.


Does Excel have a feature that automatically "unnests" a formula? Ideally I would click on D1, click on "unnest" and Excel would produce "=( ((A1+5) + 2) / 2 ).


Any other ideas?


Really grateful for any help!


BR / Öyvind
 
Im more than a little puzzled by this and I haven't come across anyone needing to expand formulae from dependent cells into their components in the primary cell. You can see this to an extent in the Evaluate Formula routine but my guess is that it wont help you.
I would suggest working with the single "unnested" version instead would eliminate the problem and give the required return value? Can you provide more information on what your trying to acheive, and restate your D1 formula which (as given) is not valid.
 
Back
Top