Function Math Reals Class

Min2Variant

" Minimum Of Two Variant Values" Return the minimum of two arguments. Returns argument on left if arguments are equal.

Signature (Visual Basic / VBA)

Public Function Min2Variant( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    Min2Variant(23, 45) = 23
    Min2Variant(-12, 4) = -12
    Min2Variant(2%, 2#) = 2%
    Min2Variant(2#, 2%) = 2#
    Min2Variant("SA", "RO") = "RO"
    Min2Variant("sa", "RO") = "sa"
    Min2Variant("sa", "RO", vbTextCompare) = "RO"

Parameters

Parameter Description
vX First of two values, the minimum of which will be returned.
vY Second of two values, the minimum 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.