Function Math Statistics Class

Percentile

Return the value from vValues at the Nth percentile. Inverse of the PercentRank function.

Signature (Visual Basic / VBA)

Public Function Percentile( _
      ByVal vN As Variant _
    , ParamArray vValues() As Variant _
    ) As Variant

Code Example

    Percentile(0.00, 12, 34, 56) = 12
    Percentile(0.25, 12, 34, 56) = 23
    Percentile(0.50, 12, 34, 56) = 34
    Percentile(0.75, 12, 34, 56) = 45
    Percentile(1.00, 12, 34, 56) = 56

Parameters

Parameter Description
vN The percentile whose corresponding value will be returned. Must be between 0 and 1 inclusive.
vValues The values that are to be processed. Can be numbers, one-dimensional numeric arrays, one-dimensional Variant arrays, one-dimensional Variant arrays with embedded arrays, or any combination of these. The current setting of the StatVarType Property determines which numeric data types are recognized by this function.

Return Value

Function returns the value from vValues whose percentile is vN, or it will use interpolation to determine a value if there is no value whose percentile is vN. Function returns Null if none of the vValues arguments are numeric, or if vN is not between 0 and 1 inclusive.