Function Math Reals Class

Max3Variant

" Maximum Of Three Variant Values" Return the maximum of three arguments. Returns the leftmost of the maximum arguments.

Signature (Visual Basic / VBA)

Public Function Max3Variant( _
      ByVal vValue1 As Variant _
    , ByVal vValue2 As Variant _
    , ByVal vValue3 As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    Max3Variant(23, 45, 56) = 56
    Max3Variant(-12, 12, 4) = 12
    Max3Variant(2%, 2#, 2!) = 2%
    Max3Variant("SA", "RO", "EN") = "SA"
    Max3Variant("SA", "ro", "EN") = "ro"
    Max3Variant("SA", "ro", "EN", vbTextCompare) = "SA"

Parameters

Parameter Description
vValue1 First of three values, the maximum of which will be returned.
vValue2 Second of three values, the maximum of which will be returned.
vValue3 Third of three values, the maximum of which will be returned.
vCompare specifies the type of string comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Note Arguments are compared using the CompareLikeDataType function; see it for more details of how arguments are fixed up and comparisons are performed.
Note This function does not support three-valued logic because of the way that the CompareLikeDataType function treats Null values.