When using iteration (circular references with the iteration option checked) is there any way of determining how many iterations were needed to reach a satisfactory answer?

Some spreadsheets that I used (a long time ago) used to have a variable that stored the number of iterations, and the variable could then be used in further calculations.

I can't see how to get this information in Planmaker. Is there a way of doing it?

Lance

## How many iterations were needed?

**Moderator:** SoftMaker Team

### Re: How many iterations were needed?

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.

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.

Sven Leßmann

SoftMaker Software GmbH

SoftMaker Software GmbH

### Re: How many iterations were needed?

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.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.

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

### Re: How many iterations were needed? Would this work?

Here is a solution for the equivalent problem in MS Excel posted on a MS newsgroup by "Charles":LanceGary wrote: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.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.

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

--------------

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

### Re: How many iterations were needed?

Hello,

I referred your question to our developers and will inform you here as soon as I have more information.

I referred your question to our developers and will inform you here as soon as I have more information.

Sven Leßmann

SoftMaker Software GmbH

SoftMaker Software GmbH

### Re: How many iterations were needed?

Thanks Sven. Lancesven-l wrote:Hello,

I referred your question to our developers and will inform you here as soon as I have more information.