Function Math Arithmetic Class

PreviousOdd

"Previous Odd Number" Returns the next smaller odd number.

Signature (Visual Basic / VBA)

Public Function PreviousOdd( _
    ByVal vX As Variant _
    ) As Variant

Code Example

    PreviousOdd(0) = -1
    PreviousOdd(1) = -1
    PreviousOdd(2) = 1
    PreviousOdd(45) = 43
    PreviousOdd(22.4) = 21
    PreviousOdd(-1.7) = -3
    PreviousOdd(-6.5) = -7
    PreviousOdd(-7.8) = -9

Parameters

Parameter Description
vX Number which is rounded-down to the previous odd number (i.e. 1, 3, 5, -1, -3, -5, etc.). Function returns Null if vX is Null or cannot be fixed up to a number.

Notes & Version History

Note Similar to calling the Floor function with a precision of 2 (two) and an offset of 1 (one), except that if vX is already an odd number, this function returns the previous odd number.