MS-Excel / Functions and Formula

Avoid Hard-code values

When you create a formula, think twice before you use any specific value in the formula. For example, if your formula calculates sales tax (which is 6.5 percent), you may be tempted to enter a formula, such as the following:

+A1*.065

A better approach is to insert the sales tax rate in a cell-and use the cell reference. Or you can define the tax rate as a named constant, using the technique presented earlier in this chapter. Doing so makes modifying and maintaining your worksheet easier. For example, if the sales tax rate changed to 6.75 percent, you would have to modify every formula that used the old value. If you store the tax rate in a cell, however, you simply change that one cell-and Excel updates all the formulas.

[Contents] [Next]