Sei sulla pagina 1di 2

AFM 271 Tutorial on Using Excel’s Solver Tool in Portfolio Problems Spring 2005

The purpose of this tutorial note is to describe how Excel’s Solver tool can be used to solve some simple problems
in the area of portfolio management. We will use an example involving four stocks: A, B, C, and D. The expected
returns and standard deviation of returns for these stocks are as follows:
Stock A Stock B Stock C Stock D
Expected return .07 .05 .15 .20
Standard deviation .13 .11 .19 .25

In addition, correlations between the four stocks are as follows:


Stock A Stock B Stock C Stock D
Stock A 1.00 0.60 0.40 -0.20
Stock B 0.60 1.00 0.30 -0.50
Stock C 0.40 0.30 1.00 -0.05
Stock D -0.20 -0.50 -0.05 1.00

The first step is to ensure that the Solver tool is available. Click on Tools and look for it. If it is not there, click on
Add-ins and tick the appropriate checkbox.

The next step is to enter the necessary statistical information in the spreadsheet. The expected returns for the four
stocks are entered in cells B3-E3 in the tutorial example available at

http://arts.uwaterloo.ca/˜kvetzal/AFM271/tutorial.xls

and the standard deviations are one line below in cells B4-E4. The correlations are entered in cells B8-E11. Based
on the standard deviations and the correlations, the covariances are calculated in cells B15-E18.

Overall Minimum Variance Portfolio


The first portfolio management problem we will attempt is to find the overall minimum variance portfolio. Recall that
in a portfolio with N risky assets, portfolio variance is given by
N N
σP2 = ∑ ∑ Xi X j σi j .
i=1 j=1

As Solver relies on numerical algorithms, we must provide an initial guess. We will use an equally-weighted
portfolio with 0.25 invested in each of the four stocks. These weights are entered in cells B25-E25. A table of
weighted covariances is provided below these weights in cells B27-E30. The entries of this table correspond to
Xi X j σi j in the portfolio variance formula.
Next to the portfolio weights is cell F25, which simply contains the sum of the weights (we need this to ensure that
Solver finds weights which do add up to 1). Beside this, in cell G25, is the portfolio variance (given the weights).
This is just the sum of all of the elements in the weighted covariance table (i.e. cells B27-E30). The standard deviation
given in cell H25 is just the square root of the variance in G25. The expected return (given the weights) is calculated
in cell I25 using the formula
N
E(RP ) = ∑ Xi E(Ri ).
i=1

Now we want to use Solver to find the minimum variance portfolio. The necessary steps are:
1. Click Tools → Solver;
2. Set Target Cell to portfolio variance (cell G25), and specify that a minimum is required (check Equal
to Min);
3. By Changing Cells (portfolio weights) cells B25-E25;
4. Subject to the Constraints (portfolio weights add up to one). Add a constraint that the sum of the
portfolio weights in cell F25 equals 1;
5. Click Solve and the OK when Solver reports that it has found a solution.

Risk/Return Tradeoff
The next problem is to solve for the minimum variance portfolio given a target portfolio return (we will use target
values of .05, .10, .15, .20). The problem is set up as above for the overall minimum variance portfolio except that now
we have to add the target returns. In particular, cells B38-E38 contain the portfolio weights, cells B40-E43 contain
the weighted covariance table, cell F38 has the sum of the portfolio weights, cells G38 and H38 contain the portfolio
variance and standard deviation respectively, cell I38 has the target portfolio return, and cell J38 has the portfolio
expected return. Assuming that short sales are allowed, the following steps should be followed:
1. Click Tools → Solver;
2. Set Target Cell to portfolio variance (cell G38), and specify that a minimum is required (check Equal
to Min);
3. By Changing Cells (portfolio weights) cells B38-E38;
4. Subject to the Constraints (portfolio weights add up to one). Add a constraint that the sum of the
portfolio weights in cell F38 equals 1 and a second constraint that the portfolio expected return in cell J38
equals the target return in cell I38;
5. Click Solve and the OK when Solver reports that it has found a solution.
6. To store this solution, copy the range of cells B38-J38 to some place lower down (e.g. cells B48-J48). It is
critical to use the Paste Special Values feature of Excel when doing this. In particular, highlight cells
B38-J38, click Edit → Copy. Then go to cell B48 and click Edit → Paste Special and then check
Values.
7. Repeat for another value of target return by changing the entry in cell I38. You should just have to do Tools
→ Solver → Solve (i.e. you should not need to change any constraints or specify the weights again). Copy
and paste special this solution below (in cell B49) and continue as needed.

A related problem where short positions are not allowed can also be easily solved. Just add another constraint that the
portfolio weights must be at least zero (i.e. in step 4 above, add a constraint that cells B48-E48 must be ≥ 0), and
proceed as above.

Potrebbero piacerti anche