Function Math Statistics Class

Range

Range of numeric arguments. Return the difference between the maximum and minimum values.

Signature (Visual Basic / VBA)

Public Function Range( _
    ParamArray vValues() As Variant _
    ) As Variant

Code Example

    Range(56, 12, 34) = 44
    Range(45, Array(12, 56, 78)) = 66
    Range(SampleData) = 120

Parameters

Parameter Description
vValues The arguments whose range is to be returned. 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 difference between the maximum and minimum numeric values among all its arguments. Function returns Null if none of the arguments are numeric.

Notes & Version History

v1.5 Note This function replaces the RangeVariantVector function, which has been removed from ArrayArithmetic Class. This function is slightly different in that it examines all of the elements in the array from its lower bound through its upper bound.