(%42%) Cash Flow Analysis: NPV, IRR, MIRR - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (%42%) Cash Flow Analysis: NPV, IRR, MIRR (/thread-15215.html) |
(%42%) Cash Flow Analysis: NPV, IRR, MIRR - Werner - 06-18-2020 07:00 PM NPV, IRR and MIRR calculations involving multiple uneven cash flows at regular intervals. This program replaces (and adds on to) my previous entry here. It will run in all flavours of the 42: HP42S, Emu42, Free42, DM42. No local variables were used. 1. Interactive mode ---------------------- usage: XEQ "CFA" -> [CFj] [IRR%] [NPV] [+%] [-%] [MIRR%] CFj : matrix of cashflows CF0..CFn in column 1 and (optionally in column 2) their corresponding frequency Nj IRR% : Internal Rate of Return, or discount rate for NPV calculation NPV : Net Present Value +% : re-investment rate applied to positive cashflows -% : financing rate applied to negative cashflows MIRR% : Modified Internal Rate of Return example 1 --------- j CFj 0 -100 000 1 18 000 2 -50 000 3 25 000 4 25 000 5 225 000 1.XEQ "CFA" 2.create the matrix 6 ENTER 1 NEWMAT EDIT [[-100000 ] [ 18000] [-50000] [ 25000] [ 25000] [225000 ]] 3.EXITALL R/S (EXITALL also exits from the menu, use R/S to get back) 4. [CFj] -> CFj=[ 6x1 Matrix ] 5. 10 [IRR%] -> IRR%=10 6. [NPV] -> 50606.83 7. [IRR%] -> 19.33 8. 10 [+%] -> +%=10 9. 5 [-%] -> -%=5 10. [MIRR%] -> 16.29 example 2 --------- j CFj 0 -100000 1 -100000 2 40000 3 40000 4 40000 5 40000 6 -10000 7 35000 8 35000 9 35000 10 35000 11 35000 12 -10000 13 30000 14 30000 15 30000 16 30000 17 30000 18 -10000 now create the 7x2 matrix [[-100000 2] [ 40000 4] [ -10000 1] [ 35000 5] [ -10000 1] [ 30000 5 ] [ -10000 1]] and determine - NPV with discount rate 8% (52933.21) - IRR% (12.19) - MIRR% with reinvestment rate 8% and financing rate 6% (9.25) 2 .Program mode ------------------- The routines NPV, IRR% and MIRR% can also be called from within a program. They all need the variable CFj to hold the cash flows (and frequencies), and additionally: NPV: IRR% discount rate MIRR%: the re-investment rate +% and financing rate -% Program listing: Code: 00 { 445-Byte Prgm } Cheers, Werner RE: (%42%) Cash Flow Analysis: NPV, IRR, MIRR - garudaquila - 09-07-2024 01:52 AM is this available on C47 ? |