18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part V<br />

Analyzing Data with Excel<br />

Avoid Hard-Coding Values in a Formula<br />

The mortgage calculation example, simple as it is, demonstrates an important point about spreadsheet design:<br />

You should always set up your worksheet so that you have maximum flexibility to make changes. Perhaps the<br />

most fundamental rule of spreadsheet design is the following:<br />

Do not hard-code values in a formula. Rather, store the values in separate cells and use cell references in the<br />

formula.<br />

The term hard-code refers to the use of actual values, or constants, in a formula. In the mortgage loan example,<br />

all the formulas use references to cells, not actual values.<br />

You could use the value 360, for example, for the loan term argument of the pmt function in cell C11. Using a<br />

cell reference has two advantages. First, you have no doubt about the values that the formula uses (they aren’t<br />

buried in the formula). Second, you can easily change the value — which is easier than editing the formula.<br />

Using values in formulas may not seem like much of an issue when only one formula is involved, but just<br />

imagine what would happen if this value were hard-coded into several hundred formulas that were scattered<br />

throughout a worksheet.<br />

FIGURE 36.1<br />

This simple worksheet model uses four input cells to produce the results.<br />

You can answer these questions by simply changing the values in the cells in range C4:C7 and observing the<br />

effects in the dependent cells (C10:C13). You can, of course, vary any number of input cells simultaneously.<br />

636

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!