I've been stuck here for hours trying to come up with a VBA excel logic for this problem. Think of this as a tree problem, in which the number of branches/nodes is determined by the user and inputted at the start.
For every node, there is 3 possible outcomes, staying flat, increasing by 1% or decreasing by 1%.
I thought about it and faced the following problems, was wondering if this makes sense or if its even doable:
1) The row insertion to build a "tree" is computationally expensive, no way around it. While this is fine for a small number of nodes, a bigger tree would just take hours for a click of the macro! ( i intend to use this up to 11/12 nodes, which takes way too long!)
- Is it possible to build a solution where macro calculations uses the same "tree" once it has been generated once, rather than to regenerate the tree every single click. i.e. to spilt up the processes, i would run a tree with 12 node at the start. And afterwhich the tweaking of the input values simply generates values that shows itself up in the tree, rather than cleaning the sheets and inserting new rows again.
2) Let me illustrate whats going on here in the best way i can.
The initial value of 100, which was used for this test, will be replaced by a formula. Lets call this formula, (A*B*Sqrt(C) + 6/X), where A, B, are constants and X is the initial % move input in the sheet which the tree branches are based off. C is the tricky bit - this is assumed to be constant until a manual intervention comes in.
Lets for a moment assume a simple tree model, with 5 nodes - giving the following structure. 1, 3, 9, 27, 81 ,243 ... 3^n, where n is the number of nodes.
Running this formula with an initial input of 2%, whereby X = 2%.
We get a nice small tree with values at this point of time.
I am trying to build a more dynamic tree here, whereby i can step in for e.g. on the 2nd value of node 3, adjust the input for C and see how the dependant nodes changes. All without affecting the previously assumed C value on nodes 1 & 2, and nodes not directly affected by the forward path of this particular value.
So in this picture below, only the blue paths should be affected by the new C value input. Is this something possible? I am so stuck...
Attachment 530711
Bookmarks