TAdvSpreadGrid - custum formulas

Hi



I'm trying to create a custom formula to emulate the =IF formula in Excel. I can see how to create custom formulas with one parameter, but how do you create custom formulas with more than one parameter. =IF should have three, ie: =IF(<condition>,<true>,<false>).



Any help would be appreciated!





Jonathan Martin

Did you have a look in the included sample function libraries?

In MISCMATHLIB.PAS there is a class TMiscMathLib that have several functions with multiple parameters.

Thanks Bruno - that's got me a bit further.



Unfortunately, most of the Excel formulas I've been asked to implement involve logical functions, such as =IF(<condition>,<true>,<false>). Have you any idea on how I would evaluate the <condition> parameter to see if it is true or false?



Also, is it possible to nest custom formulas inside another formula?



Thanks!





Jon

You can nest functions.

For conditions, use logical functions such as EQ, OR, LT, GT, AND, etc...
These return 0 or 1 depending on the condition and can then be further used in an IF() as numeric parameter.