The Museum of HP Calculators

# Internal Rate Of Return 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 Shift Label Inv CF Max 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.

The interest rate that equates the present value of all future cash flows with the original investment is known as the internal rate of return (IRR, also called discounted rate of return or yield). Given a non-zero initial investment and up to 44 positive cash flows, this program calculates the periodic IRR. If there are negative as well as positive cash flows, the program accepts up to 22 cash flows.

If more than 44 positive cash flows are entered, all cash flows over 44 will be ignored. There will be no indication, however, that more than 44 cash flows have been entered. Likewise, if more than 22 positive and negative cash flows are entered, erroneous results will occur.

Zero should be entered for periods with no cash flow.

When more than 22 cash flows are involved (all of which must be positive), the user is asked to enter the largest cash flow in step 3 because of the storage techniques being used. This value is then used to scale all other cash flows, and depending on these values, accuracy may be reduced. Consequently, the resulting periodic rate of return should be considered accurate to within +/-.01% (.0001 decimal). This largest cash flow must be entered again in sequence in step 4. If a cash flow larger than the value entered for CF MAX is keyed in at step 4, erroneous results may occur.

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.

In many instances another program may be more suitable for calculating IRR. If all cash flows are equal and equally spaced, or if all cash flows except the last are equal and equally spaced, Direct Reduction Loans is a better choice. If the cash flows occur in groups of uneven amounts, IRR Groups of cash Flows may be more suitable.

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 there are > 22 cash flows, key in the largest cash flow. CF MAX B CF MAX 4 Beginning with the first period, key in all cash flows in sequence, pressing C after each value. CF C # of CFs 5 Calculate the periodic internal rate of return D IRR(%)

## Example 1

Income property requiring a \$250,000 equity investment and to be sold in ten years is expected to generate the "after tax" cash flows shown below. What is the expected yield or IRR?

```End of Year  Cash Flow     End of Year  Cash Flow
1       \$46,423            6        \$23,199
2        40,710            7         21,612
3        36,638            8         20,037
4        34,097            9         18,460
5        32,485           10        311,406 (property
sold)
```
```Keystrokes                     Outputs
250000 A 46423 C 40710 C
36638 C 34097 C 32485 C
23199 C 21612 C 20037 C
18460 C 311406 C D              13.98  (annual IRR is 13.98%)
```

## Example 2

Property requiring a \$30,000 investment will be sold at the end of 2 years. If the investment results in the monthly net cash flows shown below, what is the IRR?

```End of Month  Cash Flow      End of Month  Cash Flow
1           \$16              13          \$201
2            50              14           195
3           175              15           178
4           181              16           197
5           143              17           210
6           147              18           220
7           151              19           206
8           176              20           194
9           184              21           187
10          193              22           190
11          157              23           201
12          190              24        35,000 (property
sold)
```
```Keystrokes                     Outputs
30000 A 35000 B
16 C 50 C 175 C 181 C
143 C 147 C 151 C 176 C
184 C 193 C 157 C 190 C         12.00 (12 cash flows input)
201 C 195 C 178 C 197 C
210 C 220 C 206 C 194 C
187 C 190 C 201 C 35000 C       24.00 (all cash flows input)
D                                1.15 (monthly IRR)
12 x                            13.79 (an annual IRR of 13.79%)
```

## The Program

```LINE  KEYS
001  *LBL A     Clear registers
002   CL REG
003   P<>S      INV->RE
004   CL REG
005   STO E
006   CF 0      Clear flags
007   CF 1
008   RTN
009  *LBL B     Input largest cash flow if #CFs > 22
010   2
011   x
012   STO 0
013   RCL E
014   X<>Y
015   ÷         INV/2 CMAX -> RE
016   STO E
017   LST X
018   SF 0      Flag 0 indicates > 22 cash flows
019   2
020   ÷
021   RTN
022  *LBL C
023   ISZ I     If F0, pack data in registers
024   F0?
025   GSB c
026   STO + (i)
027   X<>Y
028   RCL I     Display # of cash flows (add if > 22 CF)
029   F1?
030   +
031   RTN
032  *LBL c
033   2
034   3
035   RCL I
036   X!=Y?     23rd Cash flow?
037   GTO 0
038   1
039   STO I     Reset I
040   +         Drop the stack and clear x
041   CLX
042   EEX
043   5         2 CMAX/10^5 -> R0
044   STO ÷ 0
045   SF 1
046  *LBL 0
047   roll dn
048   1
049   -
050   X<>Y      Scale cash flow
051   RCL 0
052   ÷         If CFj, J>22, drop fractional part of CFj
053   F1?
054   INT
055   RTN
056  *LBL a
057   RCL I     LBL fa sets up I for count down and keeps track of
058   1         original # of cash flows by storing N.N
059   0
060   1
061   x
062   STO I
063   RTN
064  *LBL e
065   F0?
066   GTO 0     Unpacks double-stored cash flows
067   INT
068   EEX
069   5
070   ÷
071   RTN
072  *LBL 0
073   FRAC
074   RTN
075  *LBL D
076   GSB a     Set-up I
077   RCL I     NN
078   EEX
079   2
080   ÷
081   STO I     N.N->I
082   1
083   .
084   0
085   1         1+i0->RD
086   STO D
087  *LBL 4
088   CF 0
089   0
090   STO 0
091  *LBL 5
092   RCL I
093   INT
094   F1?       Get j
095   GSB d
096   RCL (i)
097   F1?
098   GSB e
099   STO + 0   Unpack CFj
100   x
101   +         f(i) in R0
102   RCL D
103   STO ÷ 0
104   ÷
105   DSZ I
106   GTO 5
107   F1?
108   GTO 0
109  *LBL 6
110   RCL 0
111   RCL E
112   -
113   X<>Y
114   ÷
115   RCL D     f/f' * (1+i)
116   x
117   RCL D
118   X<>Y
119   +         (1+i) next
120   STO D
121   LST X
122   ABS
123   EEX       f(i)/f'(i)
124   CHS
125   5
126   X>Y?
127   GTO 7     <-Done!
128   GSB a
129   GTO 4
130  *LBL 0
131   F0?
132   GTO 6
133   SF 0
134   GSB b
135   GTO 5
136  *LBL b     Loop back for lower 22 CFs
137   2
138   2
139   RCL I
140   +         Reset I to lower 22 CFs
141   STO I
142   CLX
143   +
144   RTN
145  *LBL d
146   2         Add 22 if flag 0 clear
147   2
148   F0?
149   CLX
150   +
151   RTN
152  *LBL 7     Reset R1 for another pressing of D
153   RCL D
154   1
155   -
156   STO D     RI must contain an integer here
157   EEX
158   2
159   x
160   RCL I
161   LST X
162   x
163   STO I
164   X<>Y
165   RTN
166   R/S
```

## Register Use

```R0  Used
R1  Used
R2  Used
R3  Used
R4  Used
R5  Used
R6  Used
R7  Used
R8  Used
R9  Used
S0  Used
S1  Used
S2  Used
S3  Used
S4  Used
S5  Used
S6  Used
S7  Used
S8  Used
S9  Used
A   Used
B   Used
C   Used
D   1+i0
E   Used
I   Used
```