0

I've written a user defined function in for Excel that adds the Standard Error Function. The function works well, except when using it on non-contiguous cells or ranges. For example: Function works on cells (A1:A200), but not if used on cells (A1,B2,C3,D14)

From what I can tell, the problem is coming from the line Size = WorksheetFunction.Count(numbers) when it's later used in the denominator.

  Option Explicit

Function StdErr(numbers As Range) As Double
    Dim StdDev As Double
    Dim Size As Integer

    StdDev = WorksheetFunction.StDev_S(numbers)
    Size = WorksheetFunction.Count(numbers)

    StdErr = StdDev / Sqr(Size)
End Function

1 Answer 1

0

It works Ok for me if the formula is entered as

=StdError((A1,B2,C3,D14))

so that the , is treated as a union operator rather than a parameter separator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.