Hello guys, I’m having some problems with the VAR and STDEV function, when executing these lines of code. The average is well calculated but the remaining two return very low, unrealistic and equal values (6.93018471335974E-310).
To add to a bad situation, I can’t execute the function CHISQINV as stated in the second code box below. It gives out the error:
BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.IllegalArgumentException
Message: .
Any help is deeply appreciated!
Thanks,
Rui
Code Block 1:
oRange = xSheet.getCellRangeByPosition(7, 1, 7, rangeLim)
'Media (funciona)
average = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.AVERAGE)
print average
'Variancia (ver)
variance = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.VAR)
print variance
'StdDev (ver)
stdDev = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.STDEV)
print stdDev
Code Block 2:
function CHISQINV (erro, degree)
dim oFunction as variant
oFunction = createUnoService("com.sun.star.sheet.FunctionAccess")
dim aArgument(1 to 2) as variant
dim result as double
aArgument(1)=erro
aArgument(2)=degree
result = oFunction.callFunction("CHISQ.INV", aArgument())
CHISQINV = result
end function