How can I distinguish a cell that it is blank or not while inside a user-defined function in Calc Basic? For example if I want to write an “Average” function to work just like the built-in one, I’ll try to do something like this:
Public Function AverageS(A)
Res = 0
N = 0
For i = LBound(A, 1) To UBound(A, 1)
For j = LBound(A, 2) To UBound(A, 2)
If Not IsEmpty(A(i, j)) Then
Res = Res + A(i, j)
N = N + 1
End If
Next
Next
AverageS = Res / N
End Function
But NotEmpty
does not do what I want it to. What should I do?