The Museum of HP Calculators

# Internal Rate Of Return--Groups Of Cash Flows for the HP-67

This program is Copyright © 1976 by Hewlett-Packard and is used here by permission. This program was originally published in the HP-67 Business Decisions Pac.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

 Internal Rate Of Return--Groups Of Cash Flows Shift ->Recalc Label Inv Lrg CF CF^# ->IRR Key A B C D E

## Overview

In the diagram above, the horizontal line represents the time period(s) involved, while the arrows represent the cash flows.

This program solves for the internal rate of return (IRR) when groups of uneven cash flows are involved. Given a non-zero initial investment (INV), the cash flows (CF) and the corresponding number of times each cash flow occurs (#), the periodic IRR is calculated.

Up to 20 groups of positive or negative cash flows, with each group containing a maximum of 99 cash flows, may be entered. If more than 20 groups are input, erroneous results will occur.

Zero should be entered for periods with no cash flow.

The program works with even dollar amounts. When dollars and cents are involved, the cents will be lost.

If a cash flow (other than the investment) exists with more than 8 digits (i.e., more than \$99999999.00) the user is asked to enter this value in step 3 because of the storage techniques being used. The value is then used to scale all other cash flows, and depending on these values, accuracy may be reduced. This large cash flow must be entered again in sequence in step 4.

The answer produced is the periodic rate of return. If the cash flow periods are other than annual (monthly, quarterly) the answer should be multiplied by the number of periods per year to determine the annual internal rate of return.

The calculator must be in FIX mode, as the program is dependent upon the display setting. To obtain 4 decimals of accuracy, the program card should be recorded in FIX 4 mode. More or less accuracy may be obtained by changing the display setting from DSP 4 to DSP 5, DSP 6, DSP 2, etc. However, time for solution increases as accuracy is improved.

If the user wishes to re-calculate the IRR without changing the data in any manner, simply input the number of groups and press f D This feature is useful if the calculator is halted prematurely, as it is not necessary to re-enter all of the data.

This program was designed for optimum operation when the interest rate being solved for is between 0 and 100%. The program will often solve for interest rates outside this range, but occasionally may halt prematurely with ERROR in the display. This is an error condition generated by an intermediate calculation, and indicates that the program cannot solve that particular problem.

The calculated answer may be verified by using Discounted Cash Flow Analysis - Net Present Value, to calculate the net present value. The NPV should be close to 0.

## Note

When the sign of the cash flows is reversed more than once, more than one interest rate is considered correct in the mathematical sense. While this program may find one of the answers, it has no way of finding or indicating other possibilities.

## Instructions

 Step Instructions Input Data/Units Keys Output Data/Units 1 Load side 1 and side 2. 2 Input initial investment. INV A INV 3 If one cash flow has more than 8 digits, key it in. LRG CF B LRG CF/10k* 4 Beginning with the first period, key in each cash flow and the number of times it occurs, pressing C after each group. CF ENTER # C # of groups 5 Calculate the periodic internal rate of return D IRR(%) 6 To recalculate the IRR, enter number of groups. # of groups f D IRR(%) * k = 1 (LRG CF has 9 digits) k = 2 (LRG CF has 10 digits)

## Example 1

An income property is available for \$50,000. The annual income over a 23-year projection period (all payments received at the end of the year) may be grouped as follows:

```Number of Years            Cash Flow (\$)
First 5 Years                 9,000
Next 4 Years                  7,500
Next 4 Years                  6,000
Next 3 Years                  7,500
Last 7 Years                  5,000
```

If the investor wishes a 15% return, does the property meet his objectives?

```Keystrokes                     Outputs
50000 A
9000 ENTER 5 C
7500 ENTER 4 C
6000 ENTER 4 C
7500 ENTER 3 C
5000 ENTER 7 C                 5.0000 (5 groups of cash
flows entered)
D                             15.2681 (annual IRR of
15.2681%)
```

Since the IRR is more than 15%, the property meets the investor's objectives.

## Example 2

An investment of \$620,000,000 is expected to have the following annual income stream for the next 15 years.

```Number of Years            Cash Flow (\$)
First 10 Years             100,000,000
Next 5 Years                 5,000,000
```

What is the expected rate of return?

```Keystrokes                     Outputs
620000000 A 100000000 B        62000000.00
100000000 ENTER 10 C
5000000 ENTER 5 C D                10.0649 (annual IRR of
10.0649%)
```

## The Program

```LINE  KEYS
001  *LBL A
002   CL REG
003   STO E     INV->RE
004   1
005   STO D
006   X<>Y
007   RTN
008  *LBL B    If large CF exists
009   ABS
010   EEX
011   7
012   ÷
013   LOG
014   INT     INT[log(large CF/107)]
015   X<0?
016   CLX
017   10X
018   STO D
019   RCL E
020   X<>Y     INV/10k->RE
021   ÷
022   STO E    k = 1 or 2
023   RTN
024  *LBL C
025   ISZ I    Scaling routine
026   RCL C
027   X<>Y
028   +
029   STO C
030   CLX
031   LST X
032   x
033   STO + 0  njCFj
034   LST X
035   ÷
036   LST X
037   EEX
038   2
039   ÷
040   X<>Y
041   RCL D
042   ÷
043   INT
044   X<0?
045   SF 0
046   ABS
047   +
048   F0?
049   CHS
050   LST X
051   X=0?
052   GSB 5
053   ENTER
054   ABS
055   ÷
056   x
057   STO (i)
058   RCL I    CFj * nj -> R(i)
059   CF 0
060   RTN
061  *LBL d    Routine to sum cash flows and recall number
062   GSB 3    of groups before going to iteration routine.
063   0
064   STO C
065   GTO 7
066  *LBL D
067   RCL I
068   GSB 3
069  *LBL 7
070   1
071   .        1 + initial guess
072   0
073   1
074   GSB c
075   GTO 0
076  *LBL 1
077   RCL 0
078   GSB e
079   STO C
080  *LBL 0    The secant method is used to evaluate f(i)
081   RCL B
082   RCL 0
083   STO B
084   -
085   RCL D
086   RCL C
087   STO D
088   -
089   ÷
090   x
091   STO - 0
092   RCL 0
093   ÷
094   RND
095   X!=0?
096   GTO 1
097   RCL 0
098   1
099   -
100   EEX
101   2
102   x
103   RTN
104  *LBL 3
105   1        1.01 (#groups)
106   .
107   0
108   1
109   x        ->RI
110   STO I
111   RTN
112  *LBL c
113   EEX
114   CHS
115   2
116   %        .01
117   STO C
118   +
119   STO 0
120   STO B
121   GSB e
122   STO D
123   RCL 0
124   RCL C
125   -
126   STO 0
127   GSB e
128   STO C
129   RTN
130  *LBL E
131   EEX
132   2
133   ÷
134   1
135   +        1 + i->R0
136   STO 0
137  *LBL e
138   0
139  *LBL 4
140   RCL 0    Continued fractions are used to find the PV
141   RCL (i)  of the cash flows
142   FRAC
143   ABS
144   EEX
145   2
146   x
147   CHS
148   YX
149   x
150   1
151   LST X
152   -
153   RCL (i)
154   INT
155   x
156   +
157   DSZ I
158   GTO 4
159   RCL I
160   1
161   0
162   1
163   x
164   STO I
165   X<>Y     DCF/i - INV = NPV
166   RCL 0
167   1
168   -
169   ÷
170   RCL E
171   -
172   RTN
173  *LBL 5
174   +
175   ENTER
176   RTN
177   R/S
```

## Register Use

```R0  1+i
R1  CF1 * n1
R2  CF2 * n2
R3  CF3 * n3
R4  CF4 * n4
R5  CF5 * n5
R6  CF6 * n6
R7  CF7 * n7
R8  CF8 * n8
R9  CF9 * n9
S0  CF10 * n10
S1  CF11 * n11
S2  CF12 * n12
S3  CF13 * n13
S4  CF14 * n14
S5  CF15 * n15
S6  CF16 * n16
S7  CF17 * n17
S8  CF18 * n18
S9  CF19 * n19
A   CF20 * n20
B   Used
C   f(ik)
D   f(ik-1)
E   Investment
I   Used
```