Function Math Statistics Class

HarmonicMeanArray

Harmonic mean of numeric values. More efficient version of the HarmonicMean Function but with restrictions on the arguments it accepts.

Signature (Visual Basic / VBA)

Public Function HarmonicMeanArray( _
    ByRef vValues As Variant _
    ) As Variant

Code Example

    HarmonicMeanArray(Array(12, 34, 56)) = 22.970509383378
    HarmonicMeanArray(SampleData) = 141.369758088961

Parameters

Parameter Description
vValues Numeric-type array or Variant array containing only numeric elements. This function is NOT affected by the current setting of the StatVarType Property. It assumes that vValues is an array that contains only numeric elements.

Return Value

Function returns the harmonic mean of the numeric values. Function returns Null if the array is empty, or if there is some type of error, such as if the argument is a Variant array which contains an Object reference or String.