Function Math Statistics Class

Mode

Mode (most-frequently-occurring) value of numeric arguments.

Signature (Visual Basic / VBA)

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

Code Example

    Mode(12, 34, 56) = 12
    Mode(12, 34, 56, 34) = 34
    Mode(SampleData) = 150

Parameters

Parameter Description
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 most frequently occurring of the numeric values. If there are multiple values which each occur the same number of times within the data, then the minimum of those values is returned. Function returns Null if none of the arguments are numeric.

Notes & Version History

v1.5 Note This function replaces the ModeVariantVector 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.