Pivot Tables for Financial Analysis-Excel-2003.doc

advertisement
Pivot Tables for Financial Analysis
(Excel 2003 Version)
By
David S. Allen
Associate Professor of Finance
The W. A. Franke College of Business
Northern Arizona University
david.allen@nau.edu
Presented at:
Financial Education Association
September 28, 2007
Data used in the paper is available at:
http://www.cba.nau.edu/allen-d/FEA/FEA.htm
Abstract
Pivot tables are an Excel tool for dynamically summarizing, analyzing, and reporting data in tabular and
graphical format. They allow the user to create frequency distributions and cross-tabulations of data on
several dimensions, and to display subtotals and detail at any desired level.
Pivot Table Data Sources
Pivot tables can use data contained either in the current worksheet, an external worksheet, or from an
external database using Microsoft Query. If in a worksheet, the data should be in columns, with the first
row of each column containing the field name. The data itself can be numerical values, text, or formulas.
Creating a Pivot Table
We will show by example how to create a Pivot Table using sample data on firms in the S&P 500 index.
The data is collected from http://moneycentral.msn.com/investor/finder/customstocks.asp . The first ten
observations of the worksheet containing the data are shown in Figure 1.
Figure 1: Sample worksheet data.
We begin by identifying the data to be used. If we move to the active cell upper-left corner of the data,
Excel will find it for us. In Excel 2003, click “Data” then “PivotTable.” The PivotTable and PivotChart
wizard will run. Click “Next” at Step 1, “Next” at Step 2, and “Finish” at Step 3 of the wizard as shown in
Figure 2 below.
Figure 2: Selecting the data range.
612943646
1
An empty Pivot Table will be created.
Figure 3: Empty Pivot Table.
There are four components to the Pivot Table. For each, we use the mouse to click-and-drag the fields
from the right and drop them into the appropriate container.
1) Page Field
The page field allows us to view data for one or more values for whatever field it contains. For example,
we might want to view data by market sector. So, drag the sector field and drop it into the area labeled
612943646
2
“Drop Page Fields Here”. Once we have done so, we can then use the drop-down arrow and select the
sectors we wish to examine.
2) Row Field
By dragging a field to the Row Field area, we will see a list of all possible values for that variable. Note
that for numerical data, we could end up with too many possible values to be of use. We will see later
how to handle this problem.
3) Column Field
By dragging a field to the Column Field area, we will see a list of all possible values for that variable. Note
that for numerical data, we could end up with too many possible values to be of use. We will see later
how to handle this problem.
4) Drop Data Items Here
If you drop a text field here, the Pivot Table will show the count of the items for the intersection of the row
and column.
Example 1
We will start with a simple example with a limited number of possible values for each row and column
field. Then we will show how to handle the situation when there are many possible values.
We want to see the distribution of firms across two variables: style (either growth or value) and
StockScouter Rating (which purports to predict future returns). Drag the style field to the row field, drag
the Rating field to the column field, and finally drag the symbol field to the data area. The result is seen in
Figure 4.
612943646
3
Figure 4: Pivot Table Example 1.
The Pivot Table shows that the stocks are roughly evenly split between the growth and value
designations. The mode of the Stock Scouter Rating distribution is 8.
We can create a chart of the table by clicking the Pivot Chart button and changing the Chart Type to
“Clustered Column.” The result is seen in Figure 5.
612943646
4
Figure 5: Pivot Chart for Example 1.
Sector (All)
70
Count of Symbol
60
50
Stock Scouter Rating
2
3
4
5
6
7
8
9
10
(blank)
40
30
20
10
0
Growth
Value
(blank)
Style
612943646
5
A key feature of Pivot Tables and Pivot Charts is the ability to quickly change the way in which the data is
presented. Right-click in the table, pick “Wizard” then “Layout.” By switching (dragging) the two fields as
seen in Figure 6, we can see our as a function of Stock Scouter Rating rather than by Style. Click “OK”
then “Finish” to update the table and chart.
Figure 6: Changing the Fields in Pivot Table and Chart for Example 1.
When done, both the Table and Chart are revised to reflect the new column and row fields.
612943646
6
Figure 7: Change the Fields in Pivot Table and Chart for Example 1.
Using the Page Field to View Subsets of Data
Thus far, we have viewed the distribution of data for all firms in the S&P 500 index. We can quickly view
some subset by using the page field drop down arrow. Figure 8 shows how to view the data for just the
energy stocks. The result is seen in Figure 8.
612943646
7
Figure 8: Using the Page Field to View Subsets of Data for Example 1.
612943646
8
Figure 9: Using the Page Field to View Data for Energy Stocks for Example 1.
Viewing the Underlying Data
To see the underlying data for any cell in the Pivot Table, just double-click on that cell.
For example, to see which stocks from Figure 7 are Growth stocks with a Stock Scouter Rating of 10,
click the cell circled in red.
Figure 10: Viewing the Underlying Data for Example 1.
612943646
9
Example 2
Suppose we want to summarize the distribution of firms in the S&P 500 index in a manner similar to the
Morningstar style box. We’ll put the sector in the page field, a valuation measure, P/E ratio across the top
(i.e. the column field) and capitalization on the left (i.e. row field). We can drop any field in the Data area
and will receive a count (sum) of the number of firms meeting the row and column criteria.
Figure 11: Pivot Table Example 2.
Because the variables are essentially continuous, we end up with too many rows and columns in our
Pivot Table to be of any use in summarizing the data. We can group the row and/or column fields to
make the summary more meaningful. In Figure 12, we create a group, on Market Capitalization from the
lowest value to $10,000,000,000.
Figure 12: Pivot Table Example 2 Grouping.
612943646
10
We can then expand or collapse the group as shown in Figure 13.
Figure 13: Pivot Table Example 2 Final Grouping.
Market capitalization groups are created for 0 to <$10 billion, $10 to <$20 billion, and greater than $20
billion. We also group the P/E Ratio into groups of less than 15, 15 to <30, and greater than 30.
612943646
11
The result is as shown in Figure 14.
Figure 14: Pivot Table Example 2.
The right hand column (G) and bottom row (9) give the grand total count for each column or row.
Pivot Charts
We can easily create a chart from the Pivot Table by clicking the Pivot Chart button.
Figure 15: Creating Pivot Chart Example 2.
612943646
12
Figure 16: Pivot Chart Example 2.
Sector (All)
200
Count of Symbol
180
160
140
P/E Ratio: Current2
P/E Ratio: Current
120
(blank) - (blank)
Group3
Group2
Group1
100
80
60
40
20
0
Group1
Group2
Group3
Market Capitalization2 Market Capitalization
Conclusion
PivotTables and PivotCharts are convenient tools within Excel for summarizing, reporting and displaying
large data sets. They allow the user to alter the way in which data is viewed and drill down to detailed
underlying data for subsets.
612943646
13
Download