Function Math Reals Class

PercentOfTotal

Answers X is ? percent of Y.

Signature (Visual Basic / VBA)

Public Function PercentOfTotal( _
      ByVal vX As Variant _
    , ByVal vY As Variant _
    ) As Variant

Code Example

    PercentOfTotal(5, 10) = 50
    PercentOfTotal(2, 20) = 10
    PercentOfTotal(3, 24) = 12.5

Parameters

Parameter Description
vX Number representing part of the whole. This number is usually smaller than vY. Function returns Null if vX is Null or cannot be fixed up to a number.
vY Number representing the whole. This number is usually larger than vX. Function returns Null if vX is Null or cannot be fixed up to a number. Function returns Null if vX is 0 (zero).

Notes & Version History

v1.5 BugFix Fixed this function to return Null if vY is 0 (zero), not if vX is 0 (zero) as it did in previous versions of the program.