Function Math Statistics Class

CountEqual

Count number of numeric arguments equal to the value vEqual.

Signature (Visual Basic / VBA)

Public Function CountEqual( _
      ByVal vEqual As Variant _
    , ParamArray vValues() As Variant _
    ) As Variant

Code Example

    CountEqual(1, 4, 1, 5, 1, 6, 1) = 3
    CountEqual(3, Array(1, 2, 3, 4)) = 1
    CountEqual(150, SampleData) = 10

Parameters

Parameter Description
vEqual The values whose number of occurrences within vValues is to be counted.
vValues The values that are to be counted if they equal vEqual. 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 a count of the numeric values which equal vEqual.