1 Charts and Pivot Tables Training Manual Excel 2007
2 Table of Contents Section 1: Working With Charts... 1 Lesson 1.1: Working With Charts, Part Creating a Chart...2 Formatting a Chart...4 Modifying Charts with the Layout Tab...11 Manipulating a Chart...24 Enhancing a Chart with Shapes and Graphics...31 Lesson 1.2: Working with Charts, Part Changing the Type of Chart...35 Changing the Source Data...38 Working with the Chart Axis and Data Series...41 Saving a Chart as a Template...49 Section 2: Getting the Most From Your Data Lesson 2.1: Getting the Most from Your Data...52 Using Automatic Outlining...52 Displaying and Collapsing Levels...54 Grouping Data Manually...56 Creating Subtotals...59 Lesson 2.2: PivotTables...63 What is a PivotTable?...63 Creating a PivotTable...64 Creating a PivotTable Frame...68 Specifying PivotTable Data...71 Rearranging PivotTable Data...74 Lesson 2.3: More About PivotTables...81 Modifying PivotTable Calculations...82 Formatting a PivotTable...84 Refreshing a PivotTable...88 Charting a PivotTable...89 Creating a PivotTable Based on External Data...96 Lesson 2.4: Exploring Scenarios What is a Scenario? Creating a Scenario Creating a Scenario Summary Report Saving Multiple Scenarios Lesson 2.5: What If Analysis Using a One and Two Input Data Table Using Goal Seek Using Solver Index
3 Section 1: Working With Charts In this section you will learn how to: Create charts Format charts Enhance charts with drawing tools Change the chart type Change the source data for a chart Work with chart axes and data series Create a chart template
4 Microsoft Office Excel 2007 Foundation 2 Lesson 1.1: Working With Charts, Part 1 Sometimes it can be hard to discern patterns or relationships in your data from basic tables of numerical entries. Excel 2007 s powerful chart tools can help you create a more meaningful representation of your data, by making it easy to build professional looking charts. In this lesson you will learn how to create, format, and manipulate a chart. You will also learn how to enhance your chart with Excel s drawing tools and how to add titles and tables. In the practice exercise you will create and modify a chart, step by step. Creating a Chart One of the major changes in Excel 2007 is the way that charts are created and handled. In previous versions of Excel, charts were often created with the chart wizard. In Excel 2007, a new approach is taken in hopes that a professional looking chart can be created in just a few clicks. Instead of a chart wizard, Excel 2007 provides a series of chart buttons and controls on the Insert tab. Before you create a chart, first consider the type of chart that you require. Pie charts and bar charts are good for showing comparisons. Line graphs can be useful for showing trends and
5 Microsoft Office Excel 2007 Foundation 3 plotting relationships between variables. If you want a really visually interesting chart, consider a three dimensional type. To create a chart, first select the data that you want to base your chart on. Our aim here is to create a pie chart. To do this, we have selected the region labels and the sales data. The region labels will give us category headings for our chart and the sales figures will comprise the actual data for our chart. Once you select the data, you can proceed by clicking the Insert tab to display the Insert Tab. On the Insert tab, click the Pie Charts button to display a menu of possible pie charts. For this example, we will click on the Exploding 3 D Pie Chart option.
6 Microsoft Office Excel 2007 Foundation 4 This action creates an exploding 3 D chart in the spreadsheet, showing comparative slices for the sales per region. Formatting a Chart Even after you create a chart, you can still alter its appearance. The easiest way to do this is to single click inside the box (chart area) that surrounds the chart. When you do this, you will see the words Chart Tools appear in the Excel title bar. If you click on the words Chart Tools, you will see the Design tab appear. This tab provides you with a variety of quick and easy chart reformatting options. At the far left of the tab, there is a button to completely change the chart type if you wish. For now, we will only worry about changing the general format of the chart.
7 Microsoft Office Excel 2007 Foundation 5 To begin, if you right click on the chart legend and choose Format Legend from the pop up menu, you will see a box appear around it, and you will see a Format Legend dialog box on your Excel screen. Chart legend In this dialog box, you can select any one of the legend position radio buttons to place the legend in the position specified. If you click the Fill option on the panel on the left, you will see options pertaining to the legend background fill color.
8 Microsoft Office Excel 2007 Foundation 6 As an example, if you select the Gradient Fill radio button, you will see options for fill gradients.
9 Microsoft Office Excel 2007 Foundation 7 If you click the Presets arrow, you can choose a fill gradient for the legend background from a drop menu. Here you can see the results of selecting the top radio button for the legend position, and a gradient fill for the legend background. If you click in the area of the box that is close to the chart itself, you will see a second inner box surround the chart. This box defines the plot area of the chart. (In the image above, you can see a thin line forming a box that is inside the heavy outer box.) If you right click inside the plot area and select Format Plot Area from the pop up menu, you will display a Format Plot area dialog box.
10 Microsoft Office Excel 2007 Foundation 8 You can use the options in this dialog in the same way as the Format Legend dialog. Here is the same chart with the plot area formatted as a parchment gradient. Finally, if you right click on the blank white area of the chart (around the sales heading and legend) and then select Format Chart Area from the pop up menu, you will display the Format Chart Area dialog box. Just as in the previous two examples for the legend and plot area, you can use this dialog box to format the Chart Area. Just select a radio button for Gradient fill, Solid fill, or No fill, and then choose from the available options.
11 Microsoft Office Excel 2007 Foundation 9 The following image shows the pie chart from above with a solid fill color added to the chart area. As mentioned at the beginning of this formatting discussion, clicking inside the box (chart area) around a chart will allow you to display the Design tab. In the Design tab, you will see a Chart Styles group that is fantastic for reformatting your chart. With these style buttons, Excel 2007 can provide professional looking charts in just a few clicks. The styles available in the Chart Styles group have been carefully composed to use complementary colors, shading, and formatting. It is most often the case that a quick style will produce a better looking chart than manual formatting, and with less time and effort! You can cycle through the quick styles by clicking the buttons and watching your chart s formatting change. You can use the scroll bar at the right of the group to display several more style options.
12 Microsoft Office Excel 2007 Foundation 10 More often than not, the quick styles buttons will provide a formatting option that you will find quite satisfying. Here is the same chart that we have been using, after being formatted with a quick style.
13 Microsoft Office Excel 2007 Foundation 11 If you single click on the title of the chart, a box with a thin border will form around the title. If you then double click on the title, formatting options will be displayed. You can use these options to align your title, bold your title, italicize it, change the font color, and more. Modifying Charts with the Layout Tab As you already know, when you create a chart in Excel 2007, there will be new tabs introduced on the user interface. For example, the Design tab (discussed previously) becomes available when you select the chart. You can use the buttons on the Design tab to quickly change the overall appearance and style of your chart. Another tab that can be very helpful when working with charts is the Layout tab. When you create a chart, and select it by clicking on it, you should see a Layout tab near the top of the Excel 2007 screen. Click the word Layout to see this tab s options. The most important sections of the Layout tab (in terms of charts) are the Labels group, the Axes group, the Background group, and the Analysis group.
14 Microsoft Office Excel 2007 Foundation 12 To see how these tools work, take the following Excel chart as an example. If we click on the chart to select it, we can then click the Layout tab to see what layout options we have for this chart. In the Layout tab, if you click on the Chart Title Button (In the Labels group), you will reveal a small menu of title options. Currently the chart in this example has no title, so there are two options on this title menu that we can use. You can display a title above the chart by clicking the Above Chart option, or you can place a title over the chart by clicking the Centered Overlay option.
15 Microsoft Office Excel 2007 Foundation 13 Let s use the Centered Overlay title. If we decide we don t like that one, we can easily switch to the Above Chart option. Once you have chosen a title option, you can click on the words Chart Title to display a cursor. When the cursor appears, you can type whatever text you want for your chart title. You may have noticed a More Title Options item at the bottom of the title menu. If you click this item, a Format Chart Title dialog box will appear.
16 Microsoft Office Excel 2007 Foundation 14 This will allow you to change virtually every aspect of your title. If you click the Legend button on the Layout tab, a series of options for modifying the chart legend will appear. Clicking on any of these options will implement the particular style of legend described. You should notice that each legend option has a small icon showing the location of the legend in relation to the chart.
17 Microsoft Office Excel 2007 Foundation 15 If you want to apply labels directly to the data in the chart, click the Data Labels button. Once again, the small images that accompany each option will give you a rough idea of what the results of the given option will look like. Here is the chart without data labels.
18 Microsoft Office Excel 2007 Foundation 16 Here is the same chart after adding a title and data labels. The chart was also resized by dragging with the mouse in order to make the data labels legible. The Axes button will provide you with several options for modifying the chart axes. Notice that there are two main options labeled Primary Horizontal Axis and Primary Vertical Axis. Each of these two main options contains a submenu of modification options.
19 Microsoft Office Excel 2007 Foundation 17 These submenus allow you to change the scale and numerical values used on the axis to coordinate the data. The Gridlines button (also found in the Axes group) will allow you to add or remove Minor and Major Gridlines to and from your chart. You can add horizontal gridlines, vertical gridlines, or both if you wish. The gridlines will represent the axis units on the chart to give you a clearer picture of the specific value of the data at a given place in the chart. Here is the same chart as before, with minor horizontal gridlines added.
20 Microsoft Office Excel 2007 Foundation 18 You can also add a data table to your chart by using the Data Table button on the Labels group in the Layout tab. A data table will help to clarify the meaning of your chart by displaying the data groupings in your chart in tabular form. The Trendline button in the Analysis group can be useful for pointing out a specific behavior or trend in your chart s data.
21 Microsoft Office Excel 2007 Foundation 19 Under this button, you will see a number of options. Once again, the image accompanying a given option shows a preview of what the option may look like when implemented. If you want to add error bars to your chart data (to show a range around the values depicted in the chart that the data may or may not assume) just click on the Error Bars button.
22 Microsoft Office Excel 2007 Foundation 20 Here is the same chart as before with 5% error bars added to it. The error bars show the values that the data columns could assume, if we have an estimate of 5% error. If you are working with 3 D charts, the Background group has some useful and convenient options. Let s take the following 3 D chart as an example.
23 Microsoft Office Excel 2007 Foundation 21 If you click the Chart Wall button on the Layout tab in the Background group, you will see options for showing or clearing the chart wall. The following image shows the same chart as above, with the chart wall cleared. As you can see, the chart wall represents the back plane and bottom plane of the chart. These areas show the units that the chart data is measured by. (If you clear the chart wall, the data units and gridlines will remain, just the fill color will be removed.) The chart floor, on the other hand, represents the bottom or side plane of the chart, where the data labels are shown. Here is the same chart with the wall fill color added and the floor fill color cleared. This was done with the Chart Floor button.
24 Microsoft Office Excel 2007 Foundation 22 The orientation of the chart floor and chart wall may depend on the type of chart that you create. Here is a 3 D chart with the floor removed. Here is the same chart with the floor added. As you can see, the orientation of the floor and wall of the chart differs from the chart in the previous example.
25 Microsoft Office Excel 2007 Foundation 23 When you are working with 3 D charts, you can also use all of the options in the Labels group and the Axes group. This Labels group was discussed previously in the context of 2 D charts. The buttons and menus work with 3 D charts in a similar way. Here is a 3 D chart that has been modified with the Layout tab and Design tab. Remember, the results you get when you use the buttons on the Layout tab may vary between chart types, different sized charts, and between 2 D and 3 D charts. It is usually fairly easy to undo a change that you make to a chart, so don t be afraid to experiment with the Layout tab.
26 Microsoft Office Excel 2007 Foundation 24 Manipulating a Chart Sometimes it may be necessary to resize or even move your chart around in your spreadsheet. To do this, first single click in the chart area to display the chart area border. If you place your mouse pointer on the corner of the chart border and let it hover, you will see your pointer turn into a double headed arrow.
27 Microsoft Office Excel 2007 Foundation 25 If you drag the chart corner with your mouse, you can resize the chart. Dragging your mouse horizontally will resize the length of the chart. Dragging your mouse vertically will resize the height of the chart. Finally, dragging your mouse diagonally will resize both dimensions of the chart. If you look carefully at the sides of the chart border, you will see a series of four dots. If you let your mouse pointer hover over these dots, you will see a double headed arrow.
28 Microsoft Office Excel 2007 Foundation 26 You can drag theses side edges (with the double headed arrow pointer) to increase the length or height of your chart.
29 Microsoft Office Excel 2007 Foundation 27 If you drag the corner of the chart inwards toward the center, you will make the chart smaller. To move the chart, let your mouse pointer hover over the one of the sides of the border, or over the top or bottom edge of the border.
30 Microsoft Office Excel 2007 Foundation 28 When you see your mouse pointer turn into two crossed arrows, you will be able to move the chart around your screen by mouse dragging. Here, the chart has been resized (smaller) and relocated (dragged) underneath the data.
31 Microsoft Office Excel 2007 Foundation 29 If you want to make a chart an object in another worksheet, or move the chart to a sheet of its own, do the following. First, right click on the chart and choose Move Chart from the drop down menu. This will display the Move Chart dialog box. In this example, the New Sheet radio button has been selected, which will place the chart in a new sheet called Chart1. (You can enter whatever name you like for the new sheet.)
32 Microsoft Office Excel 2007 Foundation 30 After you are ready, click the OK button to move the chart. The chart has been now been moved to a sheet of its own. Note that you can also click the Move Chart button in the Design tab to display the Move Chart dialog box. This time, if you select the Object In radio button, you can specify an existing sheet to place the chart in. In this case, we will use Sheet2.
33 Microsoft Office Excel 2007 Foundation 31 As soon as you are ready, click the OK button to move the chart. Now, the chart has been embedded as an object into the worksheet. To remove a chart from your worksheet, click in the chart area, and press the Backspace or Delete key on your keyboard. Enhancing a Chart with Shapes and Graphics There are times when you may want to add additional graphic elements to a chart, such as arrows or callouts, to point out and explain important features.
34 Microsoft Office Excel 2007 Foundation 32 In a chart like the following, you may want to point out that cone number 4 shows the greatest percentage of profits. To add a callout to the chart, click the lowest down pointing arrow beside the Shapes group on the Insert Tab.
35 Microsoft Office Excel 2007 Foundation 33 This action will display a large menu of preset shape options.
36 Microsoft Office Excel 2007 Foundation 34 Find and select a callout from the bottom of the shapes menu, and then draw it out by dragging with the mouse over the chart. (For our purposes, we ll use the cloud callout.) You can enter text into the callout by right clicking on it and selecting Edit Text from the drop down menu. You can use this procedure to add as many shapes or graphic elements to your chart as you think are necessary.
37 Microsoft Office Excel 2007 Foundation 35 Lesson 1.2: Working with Charts, Part 2 This lesson will expand on the concepts covered in the previous lesson. In this lesson you will learn how to apply a new chart type to your source data and how to change the source data while maintaining the same chart type. You will also learn how to create chart templates and how to work with the chart axis and data series. Changing the Type of Chart What do you do if you create a chart based on your spreadsheet data and you find that it just isn t quite what you were hoping for? If you are using Excel 2007, it is a quick and simple matter to apply a new chart type to your data. To change the chart type, first display the Design tab by clicking on the chart area and then click the Design tab. Now, look for the Change Chart Type button. If you click this button, you will display the Change Chart Type dialog box.
38 Microsoft Office Excel 2007 Foundation 36 With this box, you can select a new chart type or variation based on the data in the existing chart. For example, to change this chart to a clustered pyramid column chart, simply select Column from the panel on the left, and then click the clustered pyramid chart type from the column chart options that are displayed. After you make your choices, click the OK button to change the chart type. Your chart will be automatically changed according to the selections you make.
39 Microsoft Office Excel 2007 Foundation 37 Here is an example of the new chart type. You can also display the Change Chart Type dialog box by right clicking on the chart area and selecting Change Chart Type from the drop down menu that appears.
40 Microsoft Office Excel 2007 Foundation 38 Changing the Source Data As you have just seen, Excel 2007 makes it easy to change the chart type for a given set of chart data. The great thing is that Excel 2007 also makes it easy to change the source data for your chart while retaining the original chart type. In this example, the pie chart above is based on sales data per region. If you wanted the chart to depict Expenses per Region, you would have to change the source data of the chart from the sales data (cells B2 through to B5), to the expenses data (cells D2 through to D5). The first step in doing this is to right click on the chart area and click Select Data from the menu that appears.
41 Microsoft Office Excel 2007 Foundation 39 This action will display the Edit Data dialog box. At the top of the dialog box, you will see a long text field labeled Chart Data Range. This will show the range of cells that serve as the current data source for the chart. To change the data source, use your mouse to select the new data range from the spreadsheet. As you do this, you will see the new range entered into the data source field.
42 Microsoft Office Excel 2007 Foundation 40 When you complete your data selection, you will see the new data range in the Edit Data Source dialog box. The next step is to click the OK button in the lower right of the box. Now, you can see that the size of the pie slices have changed to reflect the new data.
43 Microsoft Office Excel 2007 Foundation 41 You may notice that now, having changed the source data, the title of the chart (Sales) is not accurate. To change the title, right click on it and select the Edit Text option from the drop down menu. You can now edit the text to change the title to whatever you wish. (In this case, the appropriate title choice is Expenses.) Keep in mind that if you enter new data directly into the spreadsheet cells that serve as the data source for the chart, the chart itself will be updated automatically to represent the changes. You do not have to do anything special to update direct modifications to the source data cells. Working with the Chart Axis and Data Series In a typical chart, the axes are the horizontal and vertical scales that you use to coordinate your data. Basically, data is charted with respect to its numerical position along an axis. A series is a group of data (normally a selection of cells) that is to be charted against an axis. You can have more than one series represented in a chart to show how the different series (selections of data) compare to each other. To add more than one series to a chart, right click on the chart and click Select Data from the menu that appears.
44 Microsoft Office Excel 2007 Foundation 42 This will display the Edit Data dialog box. In this dialog box you will see buttons for adding and removing a series. To add a new series to the chart click the Add button. This will display an Edit Series box where you can enter a name for the series in the name field that is provided. Next, you can enter a range of data for the series by dragging your mouse pointer to select a range from your spreadsheet. (In this example, we are adding the sales data to a column graph that shows expense data.) You can enter data sources and series by typing a range directly into its field in a dialog box, but selecting with the mouse is usually simpler. After you select the appropriate data, click the OK button on the Edit Series dialog and then on the Edit Data Source dialog.
45 Microsoft Office Excel 2007 Foundation 43 Here you can see that two series (Expenses and Sales) are represented in the chart. If you display the Edit Data Series dialog, you will see two names in the series section of the dialog box. You can select either one of these series and click Remove to remove it from the chart. You can also click the Add button to add even more data series to the chart if you wish.
46 Microsoft Office Excel 2007 Foundation 44 In the following stacked line chart, the Sales data and Profit data are represented against a Y axis consisting of dollar amounts. If you right click on one of the dollar amounts on the Y axis, you will display a drop down menu. From this menu, you can choose a Format Axis option.
47 Microsoft Office Excel 2007 Foundation 45 This will display a Format Axis dialog box. In this box, you will find controls to specify the units and adjust the scale, tick mark, and position of the Axis labels. If you select a different heading from the panel on the left of the box (the heading highlighted in this image is Axis Options) you can change the line style of the axis, the shadow, and other aspects of its format.
48 Microsoft Office Excel 2007 Foundation 46 If you want to change the labels on an axis, invoke the Select Data dialog box. You can see an edit button in the Axis Labels area (on the left) of the dialog box. If you click the Edit button, an Axis Labels box will appear, and you will be able to select the labels you want from the spreadsheet. Just drag your mouse to select the appropriate cells or manually type the cell range into the box provided.
49 Microsoft Office Excel 2007 Foundation 47 Here is the same chart that was shown previously, with its axis and labels changed. A more convenient way to quickly select a chart layout is to use the Chart Layouts available on the Design tab. With these buttons, you can quickly apply numerous layouts to your chart by clicking. You can also use the scroll bar at the right of the group to view more layout types.
50 Microsoft Office Excel 2007 Foundation 48 Here are a couple of different layouts for the chart. Both were chosen with the chart layout buttons.
51 Microsoft Office Excel 2007 Foundation 49 Saving a Chart as a Template Once you get your chart looking just the way you like it, you can save the chart type, colors, and formatting as a template that can be reused to make on future charts. Assume that this image represents a chart style and format that we are happy with and that we would like to use in the future. To save this chart as a template, display the Design tab by clicking on the chart area. On the Design tab, click the Save as Template button. This will display a Save Chart Template dialog box; it s virtually identical to the regular Save dialog. Just enter an appropriate name for your chart template and then click the Save button. By default, the templates will be saved in an Excel chart folder. When you want to use the template, just select a data range for the new chart from whatever spreadsheet you are working on and then click the small arrow at the lower right of the Charts group.
52 Microsoft Office Excel 2007 Foundation 50 This will display the Create Chart dialog box. If you select Templates in the pane on the left of the box, you will see the chart template that you saved displayed on the right side. Just click the template icon to apply the template to the selected data.
53 Microsoft Office Excel 2007 Foundation 51 Section 2: Getting the Most From Your Data In this section you will learn how to: Use automatic outlining Display and collapse levels Group data manually Create subtotals Create a PivotTable Specify data in a PivotTable Rearrange PivotTable data Modify PivotTable calculations Format a PivotTable Refresh a PivotTable Chart a PivotTable Create a PivotTable based on external data Create a scenario Create a scenario summary report Save multiple scenarios Use a one and two input data table Use Goal Seek Use the solver
54 Microsoft Office Excel 2007 Foundation 52 Lesson 2.1: Getting the Most from Your Data Sometimes, a worksheet can become so large and contain so much data that it becomes unwieldy. Totals and subtotals that summarize the data are lost in screen after screen of numbers. Thankfully, Excel 2007 has an excellent feature to help with this kind of problem. Excel s grouping and outlining features will allow you to collapse a large worksheet to show or print summary data, and to expand the same worksheet to show or modify the details. You will find these features in the Outline button group on the Data tab. Using Automatic Outlining Excel s automatic outlining feature makes outlining a worksheet fairly straightforward. Automatic outlining works best with numerical data organized into groups and sub groups by formulas or functions. The following worksheet, for example, contains monthly financial data for a business, organized into quarterly and yearly totals using formulas and the SUM function.
55 Microsoft Office Excel 2007 Foundation 53 It can be difficult to discern quarterly and yearly totals at a glance because these figures are lost in amongst the other data. To automatically outline this worksheet, click the small arrow next to the Group button in the Outline button group on the Data tab. This action will display a menu with two options: Group and Auto Outline. If you click the Auto Outline button, the spreadsheet will be outlined automatically. Here you can see the results of Excel s automatic outline. All of the original data is shown, as well as outline grouping indicators and collapse buttons marked with a ( ). You can see that the quarters (sets of three months) are grouped together to be summarized by Quarterly Totals, and that each year has been grouped to be summarized by Yearly Totals.
56 Microsoft Office Excel 2007 Foundation 54 Notice also that the columns Supplies, Wages, and Rent have been grouped under Total Expenses, and that there is an overarching group of all columns under Profit. Here you can see the summary results of Excel s automatic outline. The original information is still available in all of its detail, but it is now presented in a summary view, showing only the yearly profit totals. Of course, automatic outlines will differ from worksheet to worksheet depending on the way the data is organized. To remove the outlining from your worksheet, choose the Clear Outline option from the submenu under the Ungroup button. Displaying and Collapsing Levels Notice that in the preceding outline image, there are numbered buttons arranged in a row beside the column letters and in a column above the row numbers. Clicking on one of these numbered buttons arranged in a row will expand the rows in the worksheet to provide a given level of detail. Clicking on one of the numbered buttons arranged in a column will expand the columns in a similar way. The view of the data in the preceding image is provided by the buttons numbered 1.
57 Microsoft Office Excel 2007 Foundation 55 Clicking on the number 2 button will expand the worksheet to the second level of detail for the rows, columns, or both. This is the same worksheet after both number 2 buttons have been clicked. The worksheet rows and column have been expanded to show another level of detail. You can now see rows with quarterly totals as well as yearly totals. You can also see columns with figures for Sales and total Expenses. If you click on an expand button (marked with a + sign), a specific section of the outlined worksheet corresponding to the button will be shown. Clicking the collapse ( ) button will collapse the corresponding expanded section. If you click the number 3 button for the rows and columns, all levels of detail will be expanded to expose all of the data, as shown in the original image. Remember that with outlines, only the data that is visible on your screen will be printed. This is a great way to print only the pertinent information from an expansive worksheet. You can expand and collapse the outlined worksheet with the numbered outline buttons or with the
58 Microsoft Office Excel 2007 Foundation 56 expansion (+) and collapse ( ) buttons to reveal the level of detail you want in your printed copy. Grouping Data Manually Automatic outlining may not be adequate for worksheets with non numerical values or with no distinctive totals (from formulas or functions). If automatic outlining does not, or cannot, organize your data in the way you want, you can manually group your data as required. Take the following worksheet as an example. We would like to group the data according to teams and divisions, but if you use the Auto Outline option under the Group button, Excel displays the following alert.
59 Microsoft Office Excel 2007 Foundation 57 Because the data contains no formulas or functions providing numeric totals, Excel cannot implement automatic outlining for the worksheet. You can, however, create your own groupings by selecting the rows or columns that you want to group, and then clicking the Group button. For example, if you select the members of Team 1 (cells B4:B6) and click the Group button on the Data tab, Excel will display the following box asking if you want to group by rows or columns. If you select the Rows radio button and click OK, Excel will provide an outline indicator and a collapse/expand button for the new grouping. You should also notice numbered buttons in the top left corner. These outline level buttons work the same as before. Clicking on the number 1 button will show the first level of detail, and clicking on the 2 button will show the second, more detailed level.
60 Microsoft Office Excel 2007 Foundation 58 If you follow the same procedure for cells B8:B10, and then select cells B2:B10 and group them, you will end up with a worksheet like this. This image shown above is of the fully detailed view. If you click the 2 button, you will see the following view of the data. You can see that the individual player information for the first two teams has been collapsed from view.
61 Microsoft Office Excel 2007 Foundation 59 Clicking the number 1 button will display the highest level view (lowest detail) of the manual groupings. In this image you can see that the entire first division grouping has been collapsed from view. You can also select rows or columns for grouping by dragging your mouse over the column letters or row numbers accordingly. If you select the rows or columns this way, you will not be asked whether to group by rows or columns, as the selection you choose will clearly indicate this to Excel. To remove manual groupings, select the rows or columns corresponding to the grouping you wish to remove and click the Ungroup button. When you see the Ungroup dialog box, select the appropriate radio button, and click OK. The selected rows or columns will be ungrouped. Creating Subtotals Another kind of outlining or grouping technique available in Excel is the subtotals feature. If you have numeric data organized with clear column and row headings, you can use Excel to create automatic subtotals and grand totals for the data.
62 Microsoft Office Excel 2007 Foundation 60 The following worksheet contains sales information for different products across geographical regions. To use Excel s subtotal feature, select the range of data you want to apply subtotals to and click the Subtotal button on the Data tab. Be sure to include the column labels in your selection so Excel will be able to discern what numbers to total. For this example, you could select A1:E10 and click the Subtotal button on the Data tab to invoke the following Subtotal dialog. The drop list under the At each change in heading gives you options as to the number of rows that will be totaled. (Totals will be applied every time the values under the chosen column label changes.)
63 Microsoft Office Excel 2007 Foundation 61 The Use function drop list lets you choose from a list of functions including SUM, AVERAGE, COUNT, PRODUCT, and STDEV to apply to your data. The function you choose (normally SUM) will be used to calculate the totals. Under the Add subtotals to option list, you can select which columns to apply the totals to. You can apply totals to a single column or to multiple columns in the selected range. Finally, there are three check boxes at the bottom of the dialog box that will allow you to: Replace any pre existing subtotals Put page breaks between totaled groups so they will be printed on separate pages Place the subtotals and grand totals above or below the corresponding data If you choose to apply totals to each change in the region column while using the Sum function for the profit column, and with no page breaks, the resulting worksheet will look like this. Notice that there is a subtotal for the profit figures at every change in the region value. There is also a grand total for the Profit column at the end of the data. You can also that Excel has provided outlined levels, collapse/expand buttons, and numbered outline level buttons associated with the totals. These buttons and outlines work exactly as previously explained. The lower the number on the button, the less detailed information will be shown.
64 Microsoft Office Excel 2007 Foundation 62 To remove these subtotals, select the range of data in question (A1:E14) and click the Subtotal button to invoke the subtotal dialog box. When you see the box, click the Remove All button.
65 Microsoft Office Excel 2007 Foundation 63 Lesson 2.2: PivotTables A major function of any spreadsheet program is to help you derive meaning from your data. An Excel PivotTable is a great tool for getting perspective on, and analyzing relationships between, the columns and rows of your worksheet. In this lesson you will learn what a PivotTable is and how to create one. You will also learn how to specify and rearrange PivotTable data. Finally, in the Step by Step exercise, you will practice creating a PivotTable. What is a PivotTable? A PivotTable is a powerful tool for exploring and analyzing information. A PivotTable helps you organize and manipulate the raw data in your spreadsheet, giving you insight into patterns or relationships that might not be obvious at first glance. PivotTables also give you the power to view your data in a different context without changing the original content or structure. You can base a PivotTable on data in your current workbook or even external data from another source if you wish. With a PivotTable, you can conveniently drag and drop columns of your data to different areas of the table to examine relationships or trends that may not be obvious in a traditional Excel table or database. You could build several separate tables to explore how columns from an Excel worksheet relate to each other, or you can use one PivotTable to do the same thing. With a PivotTable, you can alter the table design without
66 Microsoft Office Excel 2007 Foundation 64 cutting, copying, pasting, or adjusting formulas and cell references. (These tasks can be frustrating when dealing with a large volume of data.) In short, PivotTables enable you to organize your data in meaningful ways without doing a lot of tedious work. You could say that a PivotTable is like several data tables rolled into one. Ideally, source data for a PivotTable should be structured like a traditional Excel table or database. The source data should have a row of unique column headings distinguishing the data and there should be no empty columns interspersed within the data. Also, blank rows in a source list or database can limit the usefulness of your PivotTable. The following image shows a block of contiguous data that is well suited for a PivotTable. Notice that there are no empty rows or columns and that every column of data has a unique label. Creating a PivotTable To create an Excel 2007 PivotTable, just select the range of data that you want to base the table on and then click the PivotTable button on the Insert tab to display the PivotTable dialog.
67 Microsoft Office Excel 2007 Foundation 65 When the Create PivotTable dialog box appears, you should notice that you are allowed to select data from an Excel table or range or from an external data source. If you choose the table or range option, the PivotTable will be based on the Excel table or range you select. You can select a table or range by dragging with your mouse before clicking the PivotTable button (before you invoke the dialog), or by specifying a range with the keyboard or mouse after you invoke the dialog. (When you select your data source, make sure that the column headings are included.) If you choose the External Data Source option, you can base your PivotTable on data outside your current workbook (such as another workbook or perhaps an external database). If you select the Use an External Data Source radio button, you will be able to display a drop list of existing connections in the Connection Name field. A typical existing connection could be a Microsoft Query or a connection you previously made to an Access database for some other purpose. Once you select your data source, you can then choose to locate your PivotTable in an Existing Worksheet or a New Worksheet. If you choose to locate it in an existing worksheet, you can specify the location for the upper left corner of the PivotTable by entering it directly into the Location data field (as a cell reference) or by clicking the target cell with your mouse. If you choose the new worksheet option, your PivotTable will be located in the upper left corner of a new worksheet that will be added to your workbook. In summary, when using the dialog box, make sure that the range of data that you want to use is visible in the Table/Range field. Use the radio buttons near the bottom of the dialog to choose where in the workbook you want the PivotTable to be located. Once you are ready, click
68 Microsoft Office Excel 2007 Foundation 66 the OK button to create your PivotTable. When you create your table, a PivotTable field List will be placed in the same worksheet as your PivotTable. Here you can see a new PivotTable area, and the corresponding PivotTable field List, placed in the existing worksheet with the source data. Once your PivotTable appears, you can add information to it by placing checks in the boxes next to the headings in the PivotTable field list.
69 Microsoft Office Excel 2007 Foundation 67 For this example, checks will be placed next to the Month field heading, the Salesman field heading, the Region field heading, and the Profit field Heading. The PivotTable will now be populated with data. As you can see in this image, the profit has been organized by Month with a total profit for the month at the top of the Sum of Profit column heading. It has also been organized by Salesman, with a total profit for each Salesman being shown in the Sum of Profit column. Because Region has been checked in the PivotTable field list, you can also see a profit breakdown by region for each salesman.
70 Microsoft Office Excel 2007 Foundation 68 The following close up view of the table tells us that the total profit for Month 1 is The Salesman A. Smith generated a total of 1020 in profit with 780 from the East region, and 240 from the Northeast region. The salesman B. Doe generated a total of 600 in profit from the North region. If you click on the minus ( ) sign preceding a salesman s name, the data for that specific salesman will be collapsed, and you will only see the total profit for that person as shown in the following example. If you click on the (+) sign in front of a name, the data will be expanded again. This holds true for the ( ) sign in front of the Month headings as well. Creating a PivotTable Frame You can also create a PivotTable by creating an empty table frame (also known as a classic layout) and adding and arranging data in the table by dropping and dragging column headings onto the frame. To create a PivotTable frame, click the PivotTable button on the Insert tab to display the PivotTable dialog box. From this point, you essentially follow the same process as described before for creating an Excel 2007 PivotTable.
71 Microsoft Office Excel 2007 Foundation 69 You select a range of data, choose a location for the table, and click the OK button when you are ready. This time, before adding data to the PivotTable table, right click on it and choose Table Options from the pop up menu.
72 Microsoft Office Excel 2007 Foundation 70 This will display the PivotTable Options dialog box. In the options box, choose the Display tab and then put a checkmark in the Classic PivotTable Layout box.
73 Microsoft Office Excel 2007 Foundation 71 This will change the Excel 2007 PivotTable into a classic PivotTable frame. (If you are already working with a classic PivotTable frame, you can clear this checkbox to convert it to an Excel 2007 style PivotTable.) Here you can see an empty PivotTable frame enhanced with blue borders. Beside it to the right, you can see the PivotTable Field List. You can easily add any of the data available in the PivotTable Field List to your PivotTable by dragging it to the table with your mouse. Specifying PivotTable Data To make the best use of your PivotTable, you should understand what the various areas in a PivotTable are for.
74 Microsoft Office Excel 2007 Foundation 72 You can see by examining an empty PivotTable frame that a PivotTable is broken into four main areas: Page, Data, Row, and Column. The Page area is ideally suited to column headings (fields) that are used to identify periodic or organizational groupings of the data in your other columns. For example, you may have column headings for sales, profit, and expenses, which are grouped according to the specific month or year over which the sales, profits, and expenses have occurred. In this case, the month or the year column heading would be placed in the page area of the PivotTable. This would allow you to populate the table with the data corresponding to whatever page field (year or month) you select. You can select a given page (year or month) and the table will display the data for that year or month. The Data area provides the underlying context for the rest of the PivotTable. The column heading you choose for the data area of the table normally has numeric values associated with it (like units sold, profit, or expenses). This is the kind of data that can be measured and totaled to reveal trends or indicate relationships between non numeric data. The Row and Column fields are used to categorize the data you want to examine. When you choose column headings to be placed in the row and column fields, you can see how your choices relate to each other in the context of the Data being examined. As an example, suppose you select a heading like Product Type for the row area, Salesman for the column area, and Profit for the data area.
75 Microsoft Office Excel 2007 Foundation 73 The resulting PivotTable will show the profit for different product types across sales people. Now that you have an idea of how the parts of a PivotTable relate, it is easy to specify data for the table. You just use your mouse to drag and drop items from the PivotTable field list to the appropriate areas of the table. Once again, you should specify a column heading (field) that represents numeric values for the data area. For the row and column areas of the table, drag and drop items that you want to analyze with respect to the chosen item for the data area. You can drag and drop more than one column heading to a table area. The resulting table will display the combined data from all of the headings you place in a single table area, as shown below.
76 Microsoft Office Excel 2007 Foundation 74 Here, both the product type heading and the salesman heading have been dragged to the row area of the table. You can now see the sales by salesman and product type displayed across regions. You will notice that the PivotTable field list at the right of your PivotTable will have checkmarks corresponding to the column headings used in the table itself. If you clear a checkbox, the associated data will be removed from the PivotTable. If you put a check in a checkbox that was cleared, the data will return to its place in the table. Rearranging PivotTable Data Once a PivotTable has been created, it is easy to rearrange the data if necessary. Note that you must be using the Classic Layout (as described in the last lesson) to rearrange data. Here we have a table showing profit by product type across regions.
77 Microsoft Office Excel 2007 Foundation 75 If we wanted to show sales figures instead of profit figures, you can remove the profit information from the data area by dragging the Sum of Profit heading in the upper left corner of the table out of the table area to drop it anywhere outside the blue table borders. This will empty the data area. Once the data area has been cleared, it is just a matter of dragging and dropping the Sales field from the PivotTable Field List to the Drop Data Items Here area of the table.
78 Microsoft Office Excel 2007 Foundation 76 In this image, the Sales heading is being dragged from the field list to the Data area of the table. Once the move is complete, this is what the table will look like: Notice that Sum of Sales is in the upper left corner and the Sales heading has a check next to it in the PivotTable field list. You can rearrange any of the categories of data in your table by following this process of dragging headings out of the table and then replacing them with headings from the PivotTable field list. You will also notice that the row, column, and page areas of the PivotTable field list have drop lists associated with them, indicated by small downward pointing triangles. You can use these drop lists to rearrange your data according to specific elements in a given category.
79 Microsoft Office Excel 2007 Foundation 77 The product drop list, for example, will let you see data for only Type 1, or Type 2, or for a specific combination of types, depending on how you configure the check boxes. This is the drop list for the Product heading. (Any of the headings in the PivotTable that have drop lists can be configured in the same way.) This table only shows data for the products of Type 1 and Type 2, as specified by in the Product drop list. (By default, the drop lists are configured to show all.) In the following image, the Month field has been dragged to the Page area of the table. The drop list for the Month field can be used to show the data for a specific month, or all of the months.