The Museum of HP Calculators

HP Articles Forum

[Return to the Index ]
[ Previous | Next ]

Financial-Management (and Modified) Internal Rate-of-Return for the HP-17BII and HP-19BII

Posted by W. Bruce Maguire II on 29 Nov 2001, 4:49 p.m.

Here is a program to calculate Financial-Management Rate of Return (MIRR) as well as Modified Internal Rate of Return (MIRR) and plain-old IRR for comparison purposes. The program is my hacked modification to an excellent FMRR/IRR program that is listed in the Grapevine Publications Pocket Guide for the HP-19BII. Please go to: and buy one of their excellent books! The HP-17BII has all the same programming capability as the 19BII, and therefore this program will work on both machines.

Obviously, the first step will be to key this program into the machine as a new formula in the "SOLVE" menu. My own convention is to name each formula, followed by a colon and two spaces for readability. This allows you to quickly find which program/formula you are interested in using. For instance, I start the following program like this:

FMRR%:  L(N:L(MP:L(MF:0)))...

You then create a cash-flow on the machine (see the User's Manual), and go to the solve menu and "CALC" this program.

For the basic problem of solving for the FMRR (or MIRR), you would enter the P/YR (number of periods per year) and the "safe" and "risk" interest rates (as Annual Percentage Rates, a.k.a. APR). Then press "$IN" to see the "up-front" amount of capital to finance the investment, and press "$OUT" to see the amount of capital available for withdrawal at the end of the investment. Press the "MORE" button to see the other variables in the equation: FMRR, MIRR, and IRR. Pressing the "FMR%" button will return (after a while) the FMRR.

The IRR can also be obtained (for comparison purposes), but remember that it is a less "stable" equation which may have multiple solutions! If you need to give the equation a guess for the IRR to aid in finding a solution, you can key in guess #1 and hit the "IRR" key, (optionally) key in guess #2 and hit the "IRR" key, and finally hit the "IRR" one last time to start the search for a solution (this solver functionality is explained in the manual).

In the following listings, there are three symbols that I use special notations to represent.
1) The multiplication symbol is "_mult_"
2) The division symbol is "_div_"
3) The summation symbol is "_sum_"

Note #1: The cash flow which is used for the calculations must be entered prior to "CALC"ing this formula, and it must be named "$". If you really prefer another name for some reason, you can always change it in the listing. Wherever "FLOW($:...)" or "#T($:...)" or "SIZEC($:...)" occurs (the cash flow operations), just change the "$" to your preferred name.

Note #2: There is a variable used for the number of periods per year: "P/YR". The "/" symbol is found in the misc. characters menu ("WXYZ", "OTHER", "MORE", "/") as are the colon and summation sign; it is not the divide key! Remember, the interest rates are entered as percent per year (not per period)---that is why the number of periods per year is a required input.

Note #3: This listing is formatted using my own style for ease of understanding and reading. Spaces should not be used when typing the formula in---except in one important case. For the "OR" operation, you must have a space on either side of the operator, or the calculator will be confused!

Oh, one last caveat for the MIRR calculation. Since I hacked the original FMRR program to add MIRR capability, it assumes that the first cash flow is negative when calculating MIRR (this saves a lot of extra code). It seems to me that a positive initial cash-flow would be a strange (but nice!) investment.



L(N: L(F: L(M: L(W: L(MP: L(MF: 0 ) ) ) ) ) )_mult_

( IF(P/YR=0: L(P/YR: 1 ) : 0 )+

L(I: G(IRR%)_div_P/YR )+

L(S: SAF%_div_P/YR )+

L(R: RSK%_div_P/YR )+

_sum_( G: SIZEC($): 1: -1: L(C: FLOW($:G) )+ L(T: #T($:G) )+ L(X: G(M)_mult_SPPV(G(S):G(T))+ G(C)_mult_USPV(G(S):G(T)) )+ L(MP: G(MP)_mult_SPPV(G(S):G(T)) )+

IF(G(C)<=0: L(MP: G(MP)+ G(C)_mult_USPV(G(S):G(T)) )+ L(M: G(X) ) : L(MF: G(MF)+ SPFV(G(R):G(N))_mult_ G(C)_mult_USFV(G(R):G(T)) )+ IF(G(M)+G(C)>0: L(W: G(W)+ SPFV(G(R):G(N))_mult_ ( G(M)+ G(C)_mult_USFV(G(R):G(T)) ) )+ L(M: 0 ) : IF(G(X)<=0: L(M: G(X) ) : L(P: IP( LN( -G(M)_mult_G(S)_div_100_div_G(C)+1 )_div_ LN( 1+G(S)_div_100 ) ) )+ L(W: G(W)+ SPFV(G(R):G(N)+G(P))_mult_ ( G(C)_mult_USFV(G(R):G(T)-G(P))+ G(M)_mult_SPPV(G(S):G(P))+ G(C)_mult_USPV(G(S):G(P)) ) )+ L(M: 0 ) ) ) )+ L(F: G(F)+ G(C)_mult_ USFV(G(I):G(T))_mult_ SPFV(G(I):G(N)) )+ L(N: G(N)+G(T) ) ) )+

IF(S($IN): $IN-G(M)-FLOW($:0) : IF(S($OUT) OR S(P/YR): $OUT-G(W) : IF(S(FMR%) OR S(SAF%) OR S(RSK%): (G(M)+FLOW($:0))_mult_ SPFV(FMR%_div_P/YR:G(N))+ G(W)+ 0_mult_(SAF%+RSK%) : IF(S(MIR%): FLOW($:0)+ G(MP)+ G(MF)_mult_SPPV(MIR%_div_P/YR:G(N)) : FLOW($:0)_mult_ SPFV(IRR%_div_P/YR:G(N))+ G(F) ) ) ) )


Let me know if there are any bugs in my listing, or if you have any problems.

Have fun, and witness the power of these great calculators!



[ Return to the Message Index ]

Go back to the main exhibit hall