Signature (Visual Basic / VBA)
Public Function Rank( _
ByVal vN As Variant _
, ByVal vAscending As Boolean _
, ParamArray vValues() As Variant _
) As Variant
Code Example
Rank(12, True, 12, 34, 34, 56) = 1
Rank(34, True, 12, 34, 34, 56) = 2
Rank(34, False, 12, 34, 34, 56) = 2
Rank(12, False, 12, 34, 34, 56) = 4
Parameters
| Parameter | Description |
|---|---|
| vN | The value whose rank will be returned. Must be one of the numeric values in vValues. |
| vAscending | True if the numeric values in vValues should be sorted in ascending order, or False if they should be sorted in descending order. |
| 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. Duplicate numbers in vValues are assigned the same rank. |
Return Value
Function returns the rank of the value vN within vValues when the numbers in vValues are sorted according to vAscending. Function returns Null if vN is not one of the numeric values in vValues.