ExcelDna icon indicating copy to clipboard operation
ExcelDna copied to clipboard

How to set an order between formulas while saving and reopening?

Open navidanari opened this issue 3 years ago • 4 comments

I have mutiple formulas running on my sheet, one of them is logging into the system that provides the data for rest of the sheet, and in the case I save the sheet and open it later on, the login formula should run first and then rest!

Thanks!

navidanari avatar Mar 16 '22 10:03 navidanari

Excel works out a dependency tree between the formulas on the sheet. So your login formula will run before any formula that takes the result of the login formula as an input. Excel does not give you other control over the sequence of evaluations in most circumstances.

govert avatar Mar 16 '22 14:03 govert

Is it possible to manipulate that dependency tree without passing one as parameter or a kinda input to another?

navidanari avatar Mar 16 '22 14:03 navidanari

You can try something like DEPENDS, but you must pass a parameter: https://github.com/xlladdins/xll/blob/master/xll/macrofun/xll_utility.cpp

keithalewis avatar Mar 16 '22 14:03 keithalewis

That's a good suggestion. In C# terms that magic function of Keith might look like this:

public static object DEPENDS(object cell, object dependent) => cell;

govert avatar Mar 16 '22 14:03 govert