Thursday, December 23, 2010

CAGR Calculation

Simple CAGR Calculation
You invested $10,000 in a portfolio on Jan 1, 2005. Let's say by Jan 1, 2006, your portfolio had grown to $13,000, then $14,000 by 2007, and finally ended up at $19,500 by 2008.What is the CAGR if you liquidate your investment on the first day of the 2008?
Four methods are available for the simple CAGR calculation, Excel IRR, Excel XIRR, Excel TVM and Mathematics. All the calculations is stated inside the photo below.

1) Excel IRR
- define your cashflow (+ve for inflow while -ve for outflow);
- ignore growing that do not contribute to your cashflow - ZERO has a great meaning in cashflow;
- Apply IRR for the selected array with the equalized period said yearly, "=IRR(B4:B7)";
2) Excel XIRR
- define your cashflow (+ve for inflow while -ve for outflow);
- define your cashflow date into your spreadsheet;
- Apply XIRR for the selected arrays cashflow and transaction date, "=XIRR(B12:B13,A12:A13)";
3) Excel TVM
- using function RATE(period,pmt,PV,FV,mode);
4) Mathematic
- (FV/PV)^(1/n)-1, n is the number of year;


Real Life CAGR Calculation
In real life, our investment may have many transactions (e.g. initial investment, top up investment, Bonus issue worth, dividend, partial liquidation, full liquidation etc.) performed in different time line. XIRR is the universal method for the example below.

Tuesday, December 7, 2010

Foreign Land Investment

Last Friday I had an appointment with a foreign land investment agent. Below is my finding:

pro:
Term: suitable for Long term investor, typically over 5 years.
Liquidity - provide an option to high liquidity ratio investor for the objective of diversifying the risk in the region, and currency. It is recommended to those who can park their money from medium to long term.
CAGR - Profitable, Overall exited project (Weighted Average: 14.82% p.a., highest: 28.09% p.a., lowest: 4.68% p.a., Source: Audit rfom PwC dated April 20, 2010, http://www.waltoninternational.com/Download-document/234-PwC-Audit-Latest). So far no negative ROI rate had been reported (No making lost) - due to the decision is made by rational masses (5-10% p.a hold up by Walton.)
Regulation - Raided by BNM, but it is cleared now with minor compound paid. Exchange Act is applied all the time to prevent money laundry.
Selling mechanism: vote is cast by investors + Walton who generally holds 6-10% total value of the land. Land selling will be executed while the voting is more than 60%.
Psychology: you will never be haunted with price drop - because it has no price report periodically in short term. 

con:
Liquidity - not suitable for low liquidity investor especially for Malaysian who has a high debt servicing ratio in their personal cashflow.
CAGR - not helpful in increasing the portfolio CAGR if new investment has a same CAGR (14.82% p.a.) than my current portfolio CAGR (13.87% - 14.48% p.a over 6 years, 14 nos of investments). It is plenty of investments that can provide higher CAGR and liquidity   
Risk - no calculated risk by the nature of its business - expected return and standard deviation can not be calculated through the daily price from the exchange because it has no daily, monthly or quarterly price.
Regulation - Exchange Act

Personal comment:
My investment philosophy: I am seeking for a CAGR>15%p.a. with the reasonable risk, means its sharpe ratio shall at least higher than 0.75. It will not be a helpful instrument even its fundamental characteristic is strong. In this land investment scenario, we have to ignore sharpe ratio.
Liquidity: I like liquidity. :)
CAGR: plenty of liquid investment has better CAGR/risk than this.
Risk measure: market risk and currency risk++. 

Friday, November 5, 2010

What is a Comprehesive Financial Planning

The outline of a comprehensive financial planning consists of

1. Executive Summary
- brief summary of the result, recommendation and action plan for the cash-flow management, risk/insurance, education, retirement, investment, estate, tax and special need planning.

2. Goals and Objectives
- goal and objective of a client in cash-flow management, risk/insurance, education, retirement, investment, estate, tax and special need planning.

3. Personal data
personal data include financial institute (bank, investment bank, estate agency, insurance company etc), dependence (official and non official if there is)

4. Current Financial Situation
- current analysis of the net worth and cash flow management by using the personal finance ratio e.g. liquidity ratio, liquid asset to net worth ratio, solvency ratio, debt to asset ratio, saving ratio, debt serving ratio etc.

5. Assumptions
- Mutual agreement between client and CFP about the assumption to be used within the agreed time frame e.g. salary increment, retirement age, share dividend increment, inflation (government official figure), inflation (personal life style figure), bank rate (fixed deposit rate, current, saving, BLR+/- rate, hire purchase rate), equity return rate, property investment ROI, rental increment rate, investment-linked return/unit trust (bond, equity, balance, index, money market etc), traditional insurance cash value rate, endowment rate, market value of a property (car, house, office etc), tax bracket based on current year income forecast, pre-retirement portfolio rate of return, post-retirement rate of return, average EPF rate of return, Amanah saham rate of return, etc.
- reference source quoted(Bank Negara Malaysia, Department of Statistic, EPF/CPF etc.)

6. Cash-Flow Management
- solution is provided after analysis (pareto on the outflow, asset distribution, liability distribution, etc)
- base line objective: reduce outflow, increase inflow, reduce liability and increase asset, depends on client willing to adjust the current life style.
- reduce outflow: pareto analysis on the high expenses, seeking the solution to minimize/optimize/reduce outflow;
- increase inflow: mutli income stream e.g. dividend income, royalty, Adsense etc.
- increase asset: asset distribution/segregation - liquid asset (e.g. equity, bond, UT, cash etc) and non liquid asset (e.g. real estate, car, collectibles etc).
- decrease liability: rule of 78 for hire purchase, car loan, credit card outstanding balance, personal loan, housing loan etc.
- Finally, improvement of the net worth and cash flow management by using the personal finance ratio e.g. liquidity ratio, liquid asset to net worth ratio, solvency ratio, debt to asset ratio, saving ratio, debt serving ratio etc, to be evaluated
- tracking: year end tracking for total inflow, total outflow, net cash flow, total liquid asset, total non liquid asset, total asset, total liability and net worth are tracked and documented.
- Millionaire Next Door method: WAQ, UAW, AAW and PAW analysis

7. Risk Management/Insurance Planning

- personal insurance need analysis (life, surgical and hospitalization and personal accident) : Human life Value and Expense Method
- property insurance: house owner, house holder (MRTA) and car insurance
- Liability insurance: professional liability
- Current existing plan matrix: all information of the insurance such as insured, agent contact, sum assured, maturity, H&S overall and annual limit, premium, term and condition, limitation etc.

8. Education Planning

- time frame: kid time frame, retirement time frame.
- education expenses forecast in today value
- overall expenses: using the XIRR/XNPV 

9. Retirement Planning
- method: target replacement ratio and expense method, principal liquidation and principal intact
- life expectancy: Malays, Chinese and Indian have different life expectancy
- shortfall/excess analysis: NIA>required, NIA=required and NIA

- approaches: sufficient retirement fund (NIA>required), financial freedom age (NIA=required, fixed ROI) and desire rate of return (NIA=required, fixed retirement age), insufficient retirement fund (NIA
- Excel Solver is used to calculate retirement age and required rate of return.

10. Investment Planning

- based on the desire return from the combined education plan, retirement plan and insurance plan, portfolio optimization is engineered accordingly to client's need.
- portfolio optimization will work on the asset allocation with the lowest risk that can offered to the client.
- Excel Solver: a) lowest risk: required ROI = expected return, seek the lowest portfolio standard deviation, b) optimize portfolio: required ROI/expected return, seek the optimize sharpe ratio

11. Estate Planning
- Will/trust/power of attorney for the asset distribution
- cost of the estate planning (charges from trust company, documentation, executor fees etc)
- nomination of the statutory asset (EPF Act and Insurance Act)

12. Tax Planning

- fully utilize the rebate and relive from the tax planning in order to save payable tax
- Tax Act section 108/110 - dividend

13. Special Needs
- financial aids for handicap child, second family, divorce etc.

14. Business Continuation
- life insurance - buy sell agreement

15. Recommendations/Implementation/Action Plan
- Time frame tracking: action plan with PIC
- Result review after a period

Tuesday, November 2, 2010

Portfolio Management - Expected Return and Risk Calculation

Due to most of my friends do not know how to calculate the portfolio risk, so I revisit the variance-covariance matrix construction. Hopefully every body can benefit from it.

Step 1: Data Collection
60 monthly historical prices of a security are collected. You may download the historical price from Yahoo! Finance.

Step 2: Calculate Expected Portfolio Return
E(r,i) = average expected return of 60 monthly data for stock i;
E(r,p) = expected return of a portfolio;

Let us take 3 individual securities for example.



 E(r,p) = 1.09% monthly
  
Step 3: Calculate Portfolio Risk
Calculation of the portfolio risk can be simplified by summing up all the component(s) inside the variance-covariance matrix.


 1) Variance-Covariance matrix for one number of stock, 1^2 = 1 component

2) Variance-Covariance matrix for two number of stocks, 2^2 = 4 components

3) Variance-Covariance matrix for three number of stock, 3^2 = 9 components

4) Variance-Covariance matrix for four number of stocks, 4^2 = 16 components

 5) Variance-Covariance matrix for five number of stocks, 5^2 = 25 components

 6) Variance-Covariance matrix for six number of stocks, 6^2 = 36 components

...ha ha, I have 14 investments in my portfolio, 14^2 = 196 components

Expected Return and Risk of a portfolio which are calculated here will be used to optimize the return-risk of a portfolio via Excel Solver. This optimization had been discussed earlier (see portfolio optimization).

Sunday, October 31, 2010

Investment Start Age, Compound Interest and Personal Investment Strategy

Investment start age plays an important role in final return. Let us assume annual return of an investment is consistent. The investment vehicles in this discussion are fixed deposits - 2.5% p.a, EPF - 6% p.a., government unit trust - 8% p.a., unit trust - 10% p.a., stock - 12% p.a. and optimized portfolio - 15% p.a.
Every year, investors invest RM12,000 in the individual vehicle. 

Scenario#1: Investment start age in different time frame
Mr.J - Start his investment during 15 years old
Mr.K - Start his investment during 25 years old
Mr.L - Start his investment during 35 years old
Mr.M - Start his investment during 45 years old
Mr.N - Start his investment during 55 years old
Mr.O - Start his investment during 65 years old

a) Fixed deposits - 2.5% p.a.

b) EPF - 6% p.a.

c) Government unit trust - 8% p.a.

d) Unit trust - 10% p.a.

e) Stock - 12% p.a.

f) Optimized portfolio - 15% p.a.

 If you want to know your investment's compounding effect, you may use the Excel formula as below (0 for end mode while 1 for begin mode):
Observation:
1. compounding effects works perfectly for those who starts his investment earlier.
 


Scenario#2: effect of the investment return 
Observation:
1. higher return has higher compounding effect. It has a huge different between 2.5% p.a. and 15% p.a.

Here is the compounding effect of the individual investment vehicle. This is the template for calculating the expected return, provided annual return is consistent.



Discussion:
we shall start our investment earlier and invest in low standard deviation portfolio rather timing the right time in the market. Bull and bear are just two animals in the jungle.

Of course, higher return rate resulted higher expected return. However, the suitable desire rate of return shall be calculated from your needs - it could be children education fund, retirement fund, personal objective or others. The desire rate of return shall match with your risk level. An investment which only offer high return without considering the risk level endangers the particular investment, especially in the bull run - traders or retailer is blind with the high rate of return from an investment.


Personal Strategies:
Expected return, standard deviation and sharpe ratio are used to determine the quality of an investment while portfolio optimization is used to decide the asset allocation of a portfolio. Dollar cost averaging is the most effective method to secure your portfolio.


Asset allocation plays important role in a successful investment.

For an optimized portfolio - Standard deviation is lower than the expected return



For my current portfolio - Standard deviation is higher than the expected return

Expected return between my optimized and current portfolio is almost the same, but the risk level is different. That is why it results lower sharpe as I compare to optimized.

For the effective allocation accordingly to the optimization from Excel solver, my current portfolio's risk is in the reducing trend. Thus, it produces an improving sharpe ratio (However, the Sharpe ratio after September is eroded with the increment of risk free rate recently). 







Saturday, October 9, 2010

Portfolio Value Calculation - Using Excel Import External Data

To calculate the portfolio value which consists of number of stocks, unit trust and others derivatives, and it could be in different currency, Excel provides the easiest and faster way to perform the job in less than a minute. It is done by linking the spreadsheet to external internet data, e.g. Yahoo Finance (currency, stock price), Investment-linked website, unit trust price list etc.

Step by step:
0. Create a Data Sheet. Then, tabulate the number of your unit trust or share or currency as per table below.

1. a) Excel 2003: Select a cell. On the Menu Bar, select Data - Import External Data.

1. b) Excel 2007: Select a cell. On the Menu Bar, select Data - From Web.

2. This will open the "New Web Query" dialog box. Your web page will be displayed. In the address block, manually type in e.g. http://finance.yahoo.com/q?s=5066.kl, and click the "Go" button.

3. a) Just as if you were searching for a quote on Yahoo!® Finance, type in the ticker symbol for the stock you want a quote on. This will be the ticker symbol quote that will be imported into MS Excel. On the dialog box, scroll down to the "Last Trade:" and check the check box that highlights "Last Trade", "Time", "Change", etc. Then at the bottom/right of the dialog box, click "Import". Another "Import Data" dialog box will appear, asking where you want to put the data.
3. b) If you want to extract data from a unit trust website, said Pruaccess,http://pruaccess.prudential.com.sg/prulinkfund/viewFundPricing.do. Then the result will be imported to spreadsheet as below.
 

4. Finally you may link the desired data to the portfolio calculation table.
5. For updating your portfolio you just need to click on the Refresh button.
  
Advance:
It can be used to calculate your net worth by compiling the subtraction of asset to the liability. By using this Excel template, daily calculation on the net worth can be done within a few minutes only.
  

Wednesday, September 15, 2010

Android Application FREENPVIRR 2.19 Tutorial - A Free NPV, IRR, XNPV, XIRR and Date Different Calculator

1.0 BACKGROUND

In finance, the net present value (NPV) of a time series of cash flows, both inflow and outflow, is defined as the sum of the present values (PVs) of the individual cash flows. In the case when all future or expected cash flows are:
- inflow (e.g as coupons, dividend etc) and;
- outflow of cash is the purchase price (normally we use negative sign for the outflow).

NPV is a central tool in discounted cash flow (DCF) analysis, and is a standard method for using the time value of money to appraise LONG-TERM PROJECTS. Used for capital budgeting, and widely throughout economics, finance, and accounting, it measures the excess or shortfall of cash flows, in present value terms, once financing charges are met.





Figure 1: To calculate the net present value for a series of cash flows that is regularly periodic, NPV function is used. Graphical illustration of net present value NPV - total sum of discounted individual cash flow to present day with the given expected rate. And, net future value NFV - total sum of compounded individual cash flow to future end date of the project with the given expected rate.


Decision making criteria:
For NPV>0 with a given expected rate, the investment would add value to the firm, thus the project may be accepted.
For NPV<0 with a given expected rate, the investment would subtract value from the firm, thus the project should be rejected.
For NPV = 0 with the expected rate, the investment would neither gain nor lose value for the firm. We should be indifferent in the decision whether to accept or reject the project. This project adds no monetary value. And, the given expected rate is now called as IRR - internal rate of return.


 
Figure 2: Returns the net present value for a schedule of cash flows that is not necessarily periodic, XNPV is used. Graphical illustration of net present value XNPV - total sum of discounted individual cash flow to present day with the given expected rate. And, net future value XNFV - total sum of compounded individual cash flow to future end date of the project with the given expected rate.

By taking XNPV = 0, XIRR is defined as below:

 

2.0 Methodology
2.1 Net present value - NPV Android Java source code

dbnpv = 0;
            for(i=0;i<=5;i++)
            dbnpv = dbnpv + dbcf[i]/(Math.pow((1+dbrate/100), i));
                       
            if (v==NPV)
            {
                if(dbnpv<=0)
                {
                    answernpv = "NPV = " + currency.format(dbnpv) +" , project/investment rejected.";
                    result.setText(answernpv);   
                }
                else
                {
                    answernpv = "NPV = " + currency.format(dbnpv) +" , project/investment accepted.";
                    result.setText(answernpv);   
                }
            }//NPV calculation closing


2.2 Internal rate of return - IRR Android Java source code

{
            {
               final double estimateddbirr = 0;
           
            Double dbirr = Double.NaN;
           
            if (dbcf != null && dbcf.length > 0)
            {
                //check if business startup costs is not zero:
                if (dbcf[0] != 0.0)
                {
                    final double noOfdbcf = dbcf.length;
                   
                    double sumdbcf = 0.0;
                    //check if at least 1 positive and 1 negative cash flow exists:
                    int noOfNegativedbcf = 0;
                    int noOfPositivedbcf = 0;
                    for (int i1 = 0; i1 < noOfdbcf; i1++)
                    {
                        sumdbcf += dbcf[i1];
                        if (dbcf[i1] > 0)
                        {
                            noOfPositivedbcf++;
                        }
                        else if (dbcf[i1] < 0)
                        {
                            noOfNegativedbcf++;
                        }
                    }
                   
                    if (noOfNegativedbcf > 0 && noOfPositivedbcf > 0)
                    { //at least 1 negative and 1 positive cash flow available?
                      //set estimated dbirr:
                        double irrGuess = 0.1; //default: 10%
                        if (estimateddbirr != Double.NaN)
                        {
                            irrGuess = estimateddbirr;
                            if (irrGuess <= 0.0) irrGuess = 0.5;
                        }
                       
                        //initialize first IRR with estimated dbirr:
                        double irr = 0.0;
                        if (sumdbcf < 0)
                        { //sum of cash flows negative?
                            irr = -irrGuess;
                        }
                        else
                        { //sum of cash flows not negative
                            irr = irrGuess;
                        }
                       
                        //iteration Newton-Raphson method:
                        final double minDistance = .0000000001; //the smaller the distance, the smaller the interpolation error
                        final double dbcftart = dbcf[0]; //business startup costs
                        final int maxIteration = 50;
                        boolean wasHi = false;
                        double cashValue = 0.0;
                        for (int i1 = 0; i1 <= maxIteration; i1++)
                        {     //for each iteration
                            //calculate cash value with current irr:
                            cashValue = dbcftart; //init value with startup costs
                            for (int j1 = 1; j1 < noOfdbcf; j1++)
                            { //for each cash flow
                                cashValue += dbcf[j1] / Math.pow(1.0 + irr, j1);
                            }//next cash flow
                           
                            if (Math.abs(cashValue) < 0.01)
                            { //cash value is nearly zero
                                dbirr = irr;
                                break;
                            }
                           
                            //adjust irr for next iteration:
                            if (cashValue > 0.0)
                            { //cash value > 0 => next irr > current irr
                                if (wasHi)
                                {
                                    irrGuess /= 2;
                                }
                               
                                irr += irrGuess;
                               
                                if (wasHi)
                                {
                                    irrGuess -= minDistance;
                                    wasHi = false;
                                }
                            }
                            else
                            { //cash value < 0 => next irr < current irr
                                irrGuess /= 2;
                                irr -= irrGuess;
                                wasHi = true;
                            }
                           
                            if (irrGuess <= minDistance)
                            { //estimated dbirr too small to continue => end calculation
                                dbirr = irr;
                                break;
                            }
                        }//next iteration
                    }//else: noOfNegativedbcf == 0 || noOfPositivedbcf == 0
                }//else: first cash flow is 0
            }//else: dbcf unavailable
            answerirr = "IRR(%) = " + formatter.format(dbirr*100) + "%";
            result.setText((String) answerirr.toString());
            //return ir;
            }//getIRR()
        } //IRR calculation closing


 2.3 Net future value - NFV Android Java source code

{
                           
                dbnfv = dbnpv*Math.pow(1+dbrate/100,number-1);
                answernfv = "NFV = " + currency.format(dbnfv);
                result.setText(answernfv);
                   
            } //NFV calculation closing


2.4 Net present value - XNPV Android Java source code

dbnpv = 0;
            for(i=0;i<=5;i++)
            dbnpv = dbnpv + dbcf[i]/(Math.pow((1+dbrate/100),ddiff[i]/365));


if (v==NPV)
            {   
                if(ddiff[5]<0||ddiff[4]<0||ddiff[3]<0||ddiff[2]<0||ddiff[1]<0||ddiff[0]<0)
                {
                    new AlertDialog.Builder(this)
                    .setTitle("Error Message")
                    .setMessage("Please key in date in ascending order!")
                    .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dlg, int sumthin) {
                    // do nothing – it will close on its own
                    }
                    })
                    .show();   
                }
                else
                {
                    if(dbnpv<=0)
                    {
                        answernpv = "NPV = " + currency.format(dbnpv) +" , project/investment rejected.";
                        result.setText(answernpv);   
                    }
                    else
                    {
                        answernpv = "NPV = " + currency.format(dbnpv) +" , project/investment accepted.";
                        result.setText(answernpv);   
                    }
                }//Error message closing
            }//NPV calculation closing


 2.5 Internal rate of return - XIRR Android Java source code

{
            {
               final double estimateddbirr = 0;
           
            Double dbirr = Double.NaN;
           
            if (dbcf != null && dbcf.length > 0)
            {
                //check if business startup costs is not zero:
                if (dbcf[0] != 0.0)
                {
                    final double noOfdbcf = dbcf.length;
                   
                    double sumdbcf = 0.0;
                    //check if at least 1 positive and 1 negative cash flow exists:
                    int noOfNegativedbcf = 0;
                    int noOfPositivedbcf = 0;
                    for (int i1 = 0; i1 < noOfdbcf; i1++)
                    {
                        sumdbcf += dbcf[i1];
                        if (dbcf[i1] > 0)
                        {
                            noOfPositivedbcf++;
                        }
                        else if (dbcf[i1] < 0)
                        {
                            noOfNegativedbcf++;
                        }
                    }
                   
                    if (noOfNegativedbcf > 0 && noOfPositivedbcf > 0)
                    { //at least 1 negative and 1 positive cash flow available?
                      //set estimated dbirr:
                        double irrGuess = 0.1; //default: 10%
                        if (estimateddbirr != Double.NaN)
                        {
                            irrGuess = estimateddbirr;
                            if (irrGuess <= 0.0) irrGuess = 0.5;
                        }
                       
                        //initialize first IRR with estimated dbirr:
                        double irr = 0.0;
                        if (sumdbcf < 0)
                        { //sum of cash flows negative?
                            irr = -irrGuess;
                        }
                        else
                        { //sum of cash flows not negative
                            irr = irrGuess;
                        }
                       
                        //iteration Newton-Raphson method:
                        final double minDistance = .0000000001; //the smaller the distance, the smaller the interpolation error
                        final double dbcftart = dbcf[0]; //business startup costs
                        final int maxIteration = 50;
                        boolean wasHi = false;
                        double cashValue = 0.0;
                        for (int i1 = 0; i1 <= maxIteration; i1++)
                        {     //for each iteration
                            //calculate cash value with current irr:
                            cashValue = dbcftart; //init value with startup costs
                            for (int j1 = 1; j1 < noOfdbcf; j1++)
                            { //for each cash flow
                                cashValue += dbcf[j1] / Math.pow(1.0 + irr, ddiff[j1]/365);
                            }//next cash flow
                           
                            if (Math.abs(cashValue) < 0.01)
                            { //cash value is nearly zero
                                dbirr = irr;
                                break;
                            }
                           
                            //adjust irr for next iteration:
                            if (cashValue > 0.0)
                            { //cash value > 0 => next irr > current irr
                                if (wasHi)
                                {
                                    irrGuess /= 2;
                                }
                               
                                irr += irrGuess;
                               
                                if (wasHi)
                                {
                                    irrGuess -= minDistance;
                                    wasHi = false;
                                }
                            }
                            else
                            { //cash value < 0 => next irr < current irr
                                irrGuess /= 2;
                                irr -= irrGuess;
                                wasHi = true;
                            }
                           
                            if (irrGuess <= minDistance)
                            { //estimated dbirr too small to continue => end calculation
                                dbirr = irr;
                                break;
                            }
                        }//next iteration
                    }//else: noOfNegativedbcf == 0 || noOfPositivedbcf == 0
                }//else: first cash flow is 0
            }//else: dbcf unavailable
            answerirr = "IRR(%) = " + formatter.format(dbirr*100) + "%";
            result.setText((String) answerirr.toString());
            //return ir;
            }//getIRR()
            }//error message closing
        } //IRR calculation closing


 2.6 Net future value - XNFV Android Java source code

{
                    dbnfv = dbnpv*Math.pow(1+dbrate/100,ddiff[number-1]/365);
                    answernfv = "NFV = " + currency.format(dbnfv);
                    result.setText(answernfv);
                }//Error message closing
            } //NFV calculation closing
            else if (v==IRR)
            {if(ddiff[5]<0||ddiff[4]<0||ddiff[3]<0||ddiff[2]<0||ddiff[1]<0||ddiff[0]<0)
            {
                new AlertDialog.Builder(this)
                .setTitle("Error Message")
                .setMessage("Please key in date in ascending order!")
                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dlg, int sumthin) {
                // do nothing – it will close on its own
                }
                })
                .show();   
            }



3.0 Excel Example:

3.1 Net present value - NPV


3.2 Internal rate of return - IRR



3.3 Net future value - NFV



3.4 Net present value - XNPV



3.5 Internal rate of return - XIRR



3.6 Net future value - XNFV



 4.0 Practical Application

4.1 Regular Period - Highway Project



 4.2 Irregular Period - Stock's return calculation



4.3 Bonus - Number of day between two dates calculation



5.0 Download - It is available at Android Market now. Search for FREENPVIRR from Application>Finance - Just in for free download. Enjoy!