Function Math Geometry Class

SphereCalc

"Sphere Calculator" Calculate some property about spheres given the value of some other property.

Signature (Visual Basic / VBA)

Public Function SphereCalc( _
      Optional ByVal vArea As Variant _
    , Optional ByVal vRadius As Variant _
    , Optional ByVal vVolume As Variant _
    ) As Variant

Code Example

    SphereCalc(100, "CALC", Null) = 2.82094791773878
    SphereCalc(100, Null, "CALC") = 94.0315972579594
    SphereCalc("CALC", Null, 100) = 104.187941573561
    SphereCalc("CALC", 3, Null) = 113.097335529233
    SphereCalc(vRadius:=3, vArea:="CALC") = 113.097335529233

Parameters

Parameter Description
vArea Surface area of the sphere.
vRadius Radius of the sphere.
vVolume Volume of the sphere.

Notes & Version History

Summary One of the arguments should contain a numeric value--the given value for that property. Pass the word "CALC" to the argument whose value is to be calculated and returned by this function. The other arguments should be missing or Null or non-numeric. Function returns Null if none of the arguments can be fixed up to a real or complex number (as defined by the IsComplex function). Otherwise, the function returns the value of the property whose argument was passed the word "CALC".
Note Function may return a complex number in the form of a string if the given dimensions are not consistent with the shape.
Note The match on the word "CALC" is case-insensitive, so for example, "CALC" and "Calc" match each other.