Pivot Tables for Financial Analysis-Excel-2007.doc

advertisement
Pivot Tables for Financial Analysis
(Excel 2007 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 2007, click “Insert” then “PivotTable.”
Figure 2: Selecting the data range.
Click the “OK” button and 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
“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.
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 selecting the default Column
style. The result is seen in Figure 5.
Figure 5: Pivot Chart for Example 1.
A key feature of Pivot Tables and Pivot Charts is the ability to quickly change the way in which the data is
presented. 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.
Figure 5: 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.
Figure 6: 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 7 shows how to view the data for just the
energy stocks. The result is seen in Figure 8.
Figure 7: Using the Page Field to View Subsets of Data for Example 1.
Figure 7: 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 8: Viewing the Underlying Data for Example 1.
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 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 8: 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 9, we create a group, on Market Capitalization from the
lowest value to $10,000,000,000.
Figure 9: Pivot Table Example 2 Grouping.
We can then expand or collapse the group as shown in Figure 10.
Figure 10: 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.
The result is as shown in Figure 11.
Figure 11: 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 12: Creating Pivot Chart Example 2.
Figure 13: Pivot Chart Example 2.
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.
Download