LanceGary wrote:
sven-l wrote:
Hello,
currently there are no functions in PlanMaker to return the number of iterations or the calculated difference to the old calculation.
The iterations are stopped when the differences to the last calculation run reach the limit given in File/Prefs/Calculate. The number of iterations is only a fail-safe limit in case this does not happen.
Yes I guessed that the number of iterations box was only a fail-safe-limit. I tried techniques like putting "=B2+1" in B2 along with the rest of the model, but the B2 counter would just run to whatever the limit was and reveal nothing about the rest of the model.
There are times when knowing how many iterations were needed to reach a certain limit can be useful - for example I have an algorithm for calculating sample size that uses that information. That is why I was asking.
Lance
Here is a solution for the equivalent problem in MS Excel posted on a MS newsgroup by "Charles":
--------------
I think this works, but I have not done exhaustive testing. Its a UDF that
will return the number of iterations.
The aCircularCell reference MUST reference one of the cells in the circular
calculation chain.
It relies on the fact that Application.Iteration seems to be False in the
initial part of the calculation when Excel is determining if there are
circular references, and then Application.Iteration becomes true when Excel
has determined that there are circular references and has switched to its
algorithm for resolving circular references.
Not sure what happens if you have more than one circular chain!
Option Explicit
Dim IterCount As Long
Public Function IterCounter(aCircularCell As Range)
Dim var As Variant
var = aCircularCell
If Not Application.Iteration Then
IterCount = 0
Else
IterCount = IterCount + 1
End If
IterCounter = IterCount
End Function
-----------------
Could something like this be written for Planmaker?
Lance