I'm implementing a CalculateCustomFunction and have a question about using ranges in custom functions.
In a case when we have a range as a parameter it is passed in CalculateCustomFunction as an array of objects. Let's say we have:
- =Func(A1:A3) in B1
- =Func(C4:C6) in D5
In both cases we have an array - something like {1,2,3} - as a parameter in "paramList[0]". In the 1) case we need paramList[0][0]. But in the 2) case we need paramList[0][1].
So the question is - how to get an offset in the array in order to get proper values. The cell's row&column cannot be used here as the ranges are shifted relatively B1 and D5 cells.
For example, if we replace Func() formula by Excel's SIN() then it will return SIN(A1) value for 1) and SIN(C5) value for 2).
I could use "contextObjects" to get a string representation of the formulas. It's easy for ranges like "A1:A3". But more complex scenarios require a full syntax analysis. The things like this are already implemented in your product. So it will be logical to add some kind of information about the offsets in the function's input parameters.
Thanks,
Leo