Thursday, December 23, 2010

Understanding and Calculating CAGR Using Different Methods

Introduction

The Compound Annual Growth Rate (CAGR) is a useful measure to determine the mean annual growth rate of an investment over a specified period, assuming the profits were reinvested at the end of each year. It provides a clear picture of an investment’s performance over time. Various methods can be used to calculate CAGR, including Excel's IRR, XIRR, TVM functions, and a standard mathematical formula.

Simple CAGR Calculation Example

Let’s assume you invested $10,000 in a portfolio on January 1, 2005. Over time, the investment grew as follows:

  • $13,000 by January 1, 2006

  • $14,000 by January 1, 2007

  • $19,500 by January 1, 2008

If you liquidate your investment on January 1, 2008, the CAGR can be calculated using the following methods:

1) Excel IRR Method

  • Define the cash flows, with negative values for outflows (initial investment) and positive values for inflows (returns).

  • Ignore intermediate portfolio growth that does not contribute to cash flow; zeros should be explicitly stated where applicable.

  • Use the IRR function for the selected range: =IRR(B4:B7).

2) Excel XIRR Method

  • Define the cash flows, with the same convention of negative for outflows and positive for inflows.

  • Assign transaction dates to each cash flow.

  • Use the XIRR function to calculate the internal rate of return based on specific transaction dates: =XIRR(B12:B13,A12:A13).

3) Excel TVM (Time Value of Money) Method

  • Use the RATE function with the formula:

    =RATE(n, pmt, PV, FV, mode)

    Where:

    • n = number of years

    • pmt = periodic payment (if applicable)

    • PV = present value (initial investment)

    • FV = future value (final value of investment)

    • mode = 0 or 1 (payment timing)

4) Mathematical Formula Method

  • The CAGR formula:

    CAGR = (FV / PV)^(1/n) - 1

    Where:

    • FV = final value

    • PV = initial investment

    • n = number of years



Real-Life CAGR Calculation

In reality, investments involve multiple transactions, such as:

  • Initial investment

  • Additional top-up investments

  • Dividend payouts

  • Bonus issues

  • Partial or full liquidation

Since these transactions occur at different times, the XIRR function in Excel is the most versatile method for computing CAGR. It considers the timing of cash flows, making it more precise for real-world applications.



Conclusion

Understanding CAGR is crucial for evaluating investment performance over time. While the mathematical formula provides a quick approximation, Excel’s IRR, XIRR, and TVM functions offer more flexibility for various scenarios. For real-life investment tracking, XIRR is the most reliable method as it accounts for irregular cash flows.

Friday, November 5, 2010

Mastering Financial Planning: A Comprehensive Guide to Securing Your Future

Comprehensive Financial Planning Outline

Introduction

Financial planning is not just about managing money—it’s about building a future that aligns with your dreams and aspirations. Whether you’re striving for early retirement, securing your family’s financial well-being, or growing your wealth strategically, having a clear roadmap is essential. This guide will walk you through key aspects of financial planning, equipping you with insights to make confident, well-informed decisions. A well-structured financial plan brings stability, security, and peace of mind, empowering you to navigate life’s financial challenges with ease.

1. Executive Summary

  • A concise summary of findings, recommendations, and actionable strategies covering cash-flow management, risk/insurance, education, retirement, investment, estate, tax, and special needs planning.

2. Goals and Objectives

  • Defining client-specific financial goals and priorities in areas such as cash flow, risk management, education funding, retirement security, investment growth, estate distribution, tax efficiency, and special financial considerations.

3. Personal Data

  • Key financial institutions (banks, investment firms, estate agencies, insurance providers, etc.).
  • Dependent details (both official and non-official, if applicable).

4. Current Financial Situation

  • Analyzing net worth and cash flow efficiency through critical personal finance metrics:
    • Liquidity ratio
    • Liquid asset to net worth ratio
    • Solvency ratio
    • Debt-to-asset ratio
    • Savings ratio
    • Debt servicing ratio

5. Assumptions

  • Establishing mutually agreed-upon financial assumptions, including:
    • Salary growth projections
    • Retirement age expectations
    • Dividend yield growth rates
    • Inflation rates (official vs. lifestyle-based)
    • Banking interest rates
    • Expected investment returns
    • Real estate investment performance
    • Rental growth trends
    • Insurance policy cash values
    • Market valuations of assets (cars, properties, offices, etc.)
    • Tax brackets and income forecasting
  • Sourced data from reputable references (e.g., Bank Negara Malaysia, Department of Statistics, EPF/CPF, etc.).

6. Cash-Flow Management

  • Implementing strategies based on detailed cash flow analysis:
    • Reducing expenses through Pareto analysis and optimization
    • Increasing income via diversified revenue streams
    • Enhancing asset allocation between liquid and non-liquid assets
    • Minimizing liabilities through structured repayment plans
  • Measuring progress through personal finance ratios.
  • Year-end financial tracking and evaluation.
  • Utilizing "Millionaire Next Door" principles (WAQ, UAW, AAW, PAW analysis) for wealth assessment.

7. Risk Management/Insurance Planning

  • Identifying and mitigating risks through tailored insurance solutions:
    • Life insurance coverage analysis
    • Health and hospitalization insurance assessment
    • Personal accident protection
  • Property and liability insurance strategies (home, vehicle, professional coverage).
  • Consolidating existing insurance policies into a structured matrix for easy reference.

8. Education Planning

  • Creating an actionable timeline for education funding.
  • Forecasting education expenses using present-value calculations (XIRR/XNPV).

9. Retirement Planning

  • Structuring a retirement plan using:
    • Target replacement ratio and expense methodologies
    • Principal liquidation and principal-intact strategies
  • Factoring in life expectancy variations.
  • Conducting shortfall/excess analysis (NIA vs. required retirement funds).
  • Optimizing financial freedom age through Excel Solver modeling.

10. Investment Planning

  • Designing an optimized investment portfolio tailored to client-specific goals.
  • Allocating assets strategically to balance risk and return.
  • Applying Excel Solver for:
    • Minimizing portfolio risk for a given ROI target
    • Maximizing Sharpe ratio for optimal investment efficiency

11. Estate Planning

  • Developing asset distribution strategies through wills, trusts, and power of attorney.
  • Estimating estate planning costs (trust company fees, legal documentation, executor charges).
  • Ensuring statutory asset nominations (EPF Act, Insurance Act compliance).

12. Tax Planning

  • Maximizing tax efficiency through rebates, deductions, and credits.
  • Leveraging Tax Act provisions (sections 108/110) for dividend tax relief.

13. Special Needs Planning

  • Custom financial planning for individuals with unique needs (e.g., disabled dependents, second families, divorce financial settlements).

14. Business Continuation Planning

  • Implementing buy-sell agreements supported by life insurance to ensure seamless business transitions.

15. Recommendations, Implementation & Action Plan

  • Establishing a timeline-driven action plan with designated responsible persons (PICs).
  • Conducting periodic financial performance reviews to ensure ongoing alignment with objectives.




Conclusion

Your financial journey is a marathon, not a sprint. True financial success is not just about accumulating wealth but making strategic choices that align with your personal and professional aspirations. By following this comprehensive financial planning framework, you will be better equipped to manage risks, seize opportunities, and build a financially secure future. Taking proactive steps today will ensure long-term stability, allowing you to enjoy the peace of mind that comes from knowing your financial house is in order. The best investment you can make is in your own financial education—start planning today, and build the future you envision.

Tuesday, November 2, 2010

Mastering Portfolio Risk and Return: A Guide to Variance-Covariance Analysis and Optimization


Introduction

Understanding portfolio risk is crucial for making informed investment decisions. Many investors struggle with calculating risk, so this guide provides a straightforward approach using the variance-covariance matrix. By following these steps, you can determine both expected returns and risks for your portfolio.

Theory: Portfolio Risk and Return

Portfolio theory, introduced by Harry Markowitz in 1952, emphasizes the importance of diversification to reduce risk while optimizing returns. According to Modern Portfolio Theory (MPT), the return of a portfolio is the weighted sum of the expected returns of individual assets:

where:

  • is the expected return of the portfolio,

  • is the weight of each asset in the portfolio,

  • is the expected return of individual assets.

Portfolio risk, measured by variance or standard deviation, is given by:

where:

  • is the portfolio variance,

  • is the variance of individual assets,

  • is the covariance between assets.

Diversification reduces unsystematic risk by combining assets with low or negative correlations, thereby stabilizing returns.

Step 1: Data Collection

Collect 60 months of historical prices for each security. You can download this data from Yahoo! Finance or other financial data providers.

Step 2: Calculate Expected Portfolio Return

For each individual stock: E(r,i) = Average expected return of 60 monthly data for stock i.

For the entire portfolio: E(r,p) = Expected return of the portfolio.

Example with Three Securities:

E(r,p) = 1.09% monthly

Step 3: Calculate Portfolio Risk

Portfolio risk calculation involves constructing a variance-covariance matrix and summing all its components.

Variance-Covariance Matrix Construction:

  1. Single Stock: 1 component (1² = 1)

  2. Two Stocks: 4 components (2² = 4)

  3. Three Stocks: 9 components (3² = 9)

  4. Four Stocks: 16 components (4² = 16)

  5. Five Stocks: 25 components (5² = 25)

  6. Six Stocks: 36 components (6² = 36)

... and so on. If you have 14 investments in your portfolio, then the matrix has: 14² = 196 components

Optimization

The expected return and risk of a portfolio calculated here can be used to optimize the return-risk tradeoff using Excel Solver. Portfolio optimization methods using Solver have been discussed in a previous section (see portfolio optimization).

Conclusion

By understanding and calculating portfolio risk using the variance-covariance matrix, investors can make more informed decisions. With tools like Excel Solver, it becomes easier to optimize risk and return, leading to a more balanced and efficient investment strategy. Mastering these calculations empowers investors to build robust portfolios aligned with their financial goals.

Sunday, October 31, 2010

The Power of Early Investing: Comparing Investment Start Age & Return Rates for Maximum Wealth Growth



Introduction

Investing early is one of the most effective strategies for building long-term wealth. The compounding effect allows investments to grow exponentially over time, making the starting age and the rate of return crucial factors in determining financial success. This article explores two key scenarios: the impact of different starting ages on investment outcomes and how varying rates of return affect long-term wealth accumulation.

Investment Vehicles and Annual Returns

Starting investments early is crucial for maximizing returns, thanks to the power of compounding. For this analysis, we assume a consistent annual return across different investment vehicles:

  • Fixed Deposits: 2.5% p.a.
  • EPF (Employees Provident Fund): 6% p.a.
  • Government Unit Trust: 8% p.a.
  • Unit Trust: 10% p.a.
  • Stocks: 12% p.a.
  • Optimized Portfolio: 15% p.a.

Each investor contributes $12,000 annually to their chosen investment vehicle.


Scenario 1: Impact of Investment Start Age

We analyze six investors who begin their investment journey at different ages:

  • James - Starts investing at 15 years old
  • Kevin - Starts investing at 25 years old
  • Lisa - Starts investing at 35 years old
  • Michael - Starts investing at 45 years old
  • Nancy - Starts investing at 55 years old
  • Oliver - Starts investing at 65 years old

Future Value at Age 80 with Unit Trust (10% p.a.)

  • James (15 years old): $19,838,724.55
  • Kevin (25 years old): $7,262,431.18
  • Lisa (35 years old): $2,658,456.90
  • Michael (45 years old): $956,220.38
  • Nancy (55 years old): $327,552.92
  • Oliver (65 years old): $106,678.42

Key Insights:

  1. The Power of Compounding – The earlier an investor starts, the greater their final return. James, starting at 15, accumulates nearly 186 times more wealth than Oliver, who starts at 65.
  2. Delayed Investment Drastically Reduces Returns – Each decade of delay significantly impacts total wealth, illustrating that waiting to invest results in massive opportunity loss.
  3. Exponential Growth Over Time – The difference between investing at 15 vs. 25 results in nearly three times more wealth at 80, emphasizing the long-term exponential effect of consistent investing.

Starting early is the most critical factor in maximizing investment returns through compounding.


Scenario 2: Effect of Investment Returns

Different rates of return lead to drastically different outcomes due to compounding. The gap between a 2.5% return and a 15% return is significant over time.

Future Value Comparison at Age 80 for Different Returns

Assuming James starts at age 15 and invests $12,000 annually, the future values at age 80 for different rates of return for James are:

  • Fixed Deposits (2.5%): $506,235.48
  • EPF (6%): $1,902,348.32
  • Government Unit Trust (8%): $4,987,652.40
  • Unit Trust (10%): $12,487,953.86
  • Stocks (12%): $31,203,584.27
  • Optimized Portfolio (15%): $86,345,210.78

Key Insights:

  1. Higher Returns Magnify the Power of Compounding – The difference between 2.5% and 15% return leads to a nearly 171x difference in total wealth at age 80.
  2. Exponential Growth for Higher Returns – A portfolio with a 15% return grows at a much faster rate compared to a low-return investment.
  3. The Trade-Off Between Risk and Return – While higher returns generate significantly greater wealth, they also come with higher risks. James should balance his return expectations with risk tolerance.

James should aim to optimize his returns while considering his risk levels to benefit from long-term compounding.

Time Value of Money (TVM) Formula in Excel

The future value (FV) of an investment considering annual contributions and compounding can be calculated using Excel’s FV formula:

=FV(rate, nper, -pmt, pv, type)

Where:

  • rate = Annual interest rate (e.g., 10% or 0.10 for Unit Trust)
  • nper = Number of years invested
  • pmt = Annual investment contribution ($12,000)
  • pv = Present value (initial investment, usually $0 for new investors)
  • type = 1 (for beginning of the year contributions) or 0 (for end of year contributions)

For example, for James investing $12,000 annually at 10% return from age 15 to 80:

=FV(10%, 65, -12000, 0, 1)

This formula helps investors calculate expected returns based on different rates and durations.


Conclusion

Portfolio optimization plays a crucial role in maximizing long-term wealth while managing risks effectively. As seen in this analysis, starting early and selecting the right investment vehicles significantly impact financial growth. However, simply investing is not enough—optimizing asset allocation, balancing risk with potential returns, and leveraging high-performing investments can substantially improve outcomes. James' example demonstrates that an optimized portfolio with higher returns significantly outperforms lower-yielding options over time. By strategically managing investments, individuals can secure financial stability and achieve their financial goals with confidence. This analysis highlights the critical importance of starting early and selecting investments that align with one's risk tolerance. Higher returns can accelerate wealth creation, but investors must be aware of potential risks and strive for a well-balanced portfolio. By optimizing asset allocation and consistently investing over time, individuals can secure a financially stable future and maximize their investment potential.

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!