Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenFri, 06 Sep 2019 18:07:08 +0200Weighted Average. Runtime Error: Index out of defined Range.https://ask.libreoffice.org/en/question/207684/weighted-average-runtime-error-index-out-of-defined-range/Function Weighted_Average(optional x(), optional w())
dim WA as double
dim SUMWX as double
dim SUM as double
For i = 1 to UBound(x)
SUMWX = SUMWX + w(i,1)*x(i,1)
Next i
For b = 1 to UBound(x)
SUM = SUM + w(i,1)
Next b
WA = SUMWX/SUM
Weighted_Average = WA
End FunctionJackZedFri, 06 Sep 2019 18:07:08 +0200https://ask.libreoffice.org/en/question/207684/