11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 16: Intentional Circular References 423<br />

Solving a recursive equation<br />

A recursive equation is an equation in which a variable appears on both sides of the equal sign.<br />

The following equations are examples of recursive equations:<br />

x = 1/(x+1)<br />

x = COS(x)<br />

x = SQRT(X+5)<br />

x = 2^(1/x)<br />

x = 5 + (1/x)<br />

You can solve a recursive equation by using a circular reference. First, make sure that you turn on<br />

the Enable Iterative Calculation setting. Then convert the equation into a self-referencing formula.<br />

To solve the first equation, enter the following formula into cell A1:<br />

=1/(A1+1)<br />

The formula converges at 0.618033989, which is the value of x that satisfies the equation.<br />

Sometimes, this technique doesn’t work. For example, the formula allows the possibility of a division<br />

by zero error. The solution is to check for an error. If the formula displays an error, modify<br />

the iterated value slightly. For example, the preceding formula can be rewritten using the<br />

IFERROR function:<br />

=IFERROR(1/(A1+1),A1+0.01)<br />

IFERROR was introduced in Excel 2007. Following is a version of the formula that’s compatible<br />

with previous versions of Excel:<br />

=IF(ISERR(1/(A1+1)),A1+0.01,1/(A1+1))<br />

Figure 16-6 shows a worksheet that calculates several recursive equations in column B. The formulas<br />

in column D provide a check of the results. For example, the formula in column D2 is<br />

=1/(B2+1)<br />

<strong>Formula</strong>s in column E display the difference between the values in column B and column D. If the<br />

solution is correct, column E displays a zero (or a value very close to zero).<br />

You can access recursive equations.xlsx, the workbook shown in Figure 16-6, on<br />

the companion CD-ROM.

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

Saved successfully!

Ooh no, something went wrong!