ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reason for calculation... (https://www.excelbanter.com/excel-programming/280163-reason-calculation.html)

Dag Johansen[_6_]

Reason for calculation...
 
Hi,

is it possible to know in a custom function whether the
function is called as a result of one of it's dependants
having changed?

Example:

Cell formula "=myF(A5, C5)"

myF is now called if the value of cell A5 is updated. I
would like, in myF(), to detect this particular scenario.

Happy coding,

Dag

Charles Williams

Reason for calculation...
 
Hi Dag,

One approach would be to store the values of the arguments in static
variables and compare.
You would have to use ISEMPTY to check for the case where the function is
called more than once per calculation cycle.
(see http://www.decisionmodels.com/calcsecretsj.htm)

of course in a normal recalculation of a non-volatile function the function
only gets called when one or more of its precedents change anyway (apart
from the multiple calls per recalculation problem). But inside a custom
function I do not know of a way of detecting which calculation method is
being used (full,recalc,sheet etc).


regards
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com

"Dag Johansen" wrote in message
...
Hi,

is it possible to know in a custom function whether the
function is called as a result of one of it's dependants
having changed?

Example:

Cell formula "=myF(A5, C5)"

myF is now called if the value of cell A5 is updated. I
would like, in myF(), to detect this particular scenario.

Happy coding,

Dag





All times are GMT +1. The time now is 08:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com