Serving the Quantitative Finance Community

 
User avatar
Hens
Topic Author
Posts: 0
Joined: November 9th, 2004, 6:49 pm

Excel Dependancies

June 26th, 2007, 8:33 pm

In excel, if I have a chain of dependancies through a series of cells, changing the first cell (the root) of the dependancy correctly triggers recalculation.I have a problem with this when using an XLL I have written in c++. My (simplfied*) xll contains a double, and two methods setNumber(double) and double getNumber(). I want to do the following:A1: some numberA2: setNumber(A1)A3: getNumber()This works fine at first, but does not recalculate properly. In fact, if you trace dependancies, A3 does not appear to depend on anything (which i understand, just do not like). So, when I change A1 I have to manually go and recalculate A3. ctrl-alt-f9 does not help, and anyway - I want to understand this. If there is a massive montecarlo lurking somewhere, I can't just recalc trivially.Q: Can I for force Excel to recognise non-obvious dependancies?Q: If not, what can I do?Thanks for reading, hens*Actually, my dll contains a quantlib objecthandler
 
User avatar
Traden4Alpha
Posts: 3300
Joined: September 20th, 2002, 8:30 pm

Excel Dependancies

June 26th, 2007, 11:10 pm

Just define A3 to be getNumber()+0*A1. You can even use Excel's Find and Replace All to modify all formulas with "getNumber(" in them.If you have a large number of input parameters in which a change in any should trigger a recalc, then define a cell as the sum of these parameters times zero and then reference that dependent cell in all the cells that make an untraceable call.
 
User avatar
Hens
Topic Author
Posts: 0
Joined: November 9th, 2004, 6:49 pm

Excel Dependancies

June 27th, 2007, 4:55 am

That's a nice solution. Thanks!
 
User avatar
roberts
Posts: 0
Joined: March 15th, 2007, 1:04 pm

Excel Dependancies

July 3rd, 2007, 4:27 am

QuoteOriginally posted by: Traden4AlphaJust define A3 to be getNumber()+0*A1. You can even use Excel's Find and Replace All to modify all formulas with "getNumber(" in them.If you have a large number of input parameters in which a change in any should trigger a recalc, then define a cell as the sum of these parameters times zero and then reference that dependent cell in all the cells that make an untraceable call.Just define A3 to be getNumber, it is a really good tip for me, Thanks.
 
User avatar
Jim
Posts: 1
Joined: February 1st, 2002, 5:20 pm

Excel Dependancies

July 3rd, 2007, 12:12 pm

QuoteQ: If not, what can I do?Go read up on volatile and non-volatile functions in Excel. Non-volatile functions are re-evaluated only when one or more of the function arguments change; Volatile functions (like Now() and Rand()) are re-evaluated every time the worksheet is calc'd. If getNumber() really is just a getter for an existing number, make that function volatile.
 
User avatar
gatechfe08
Posts: 0
Joined: January 25th, 2008, 4:31 pm

Excel Dependancies

March 8th, 2008, 3:36 pm

how do u incorporate a customised function in C++.. into MS excel through dll/xll??? i have tried everthng... doesnot work though... please help me out....tried using sample codes on net... still does not work...