Creating Custom Functions with Optional Arguments

Some of Excel's built-in functions let you omit certain arguments. For example, if you omit the type and future value arguments from the PV function, Excel still computes the result because those arguments are optional. Your custom functions can also make use of optional arguments.

For example, suppose you want to create a custom function called RightTriangle that uses the Pythagorean theorem to compute the length of any side of a right triangle given the lengths of the other two sides. The equation that expresses the Pythagorean theorem is a2 + b2 = c2, in which a and b are the short sides and c is the hypotenuse. Given any two sides, you can use this equation to solve for the third side.

In a general-purpose ...

Get Microsoft® Office Excel 2003 Inside Out now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.