Overview A PivotTable report is an interactive table that allows you to quickly group and summarise information from a data source. You can rearrange (or pivot) the table to display different perspectives and you can display the details for specific areas of interest. From this..to this Creating a Data Source in Excel The data to be used in a PivotTable or PivotChart must be set up in a list format and the following rules must be adhered to: Each column is a field of data. Each field should only contain one piece of information (e.g. a date, not a date and contract duration.) There must be a clear column heading to describe each column of information. The column headings must all be on just one row, and each heading should be unique. The column headings should be formatted differently from the data (e.g. make them bold) The column headings must either be row 1 or have an empty row above it. Each row is a record of data, with data in at least one of the data columns. The records must be on individual rows, immediately under the headings. The information must form a solid block and cannot contain any intervening blank rows or columns. A column may be empty of data, provided that it has a heading. Creating a PivotTable 1. Select any cell within the range of data. 2. Select the Insert tab. TIP If using an Excel table or range, Excel will automatically pick up the range to be analysed as long as your data is in a recognised list format (see, Creating a data source in Excel earlier in this guide). This can be adjusted manually, if required. 5. Select where you want the PivotTable placed, viz. a new worksheet or, the existing worksheet. If selecting the existing worksheet, you must also specify the cell into you want the top left-hand corner of the PivotTable to be placed. 6. Click OK. 7. The area for the PivotTable will then be displayed on the sheet, together with the PivotTable Fields List and the PivotTable Tools made available at the right of the ribbon tabs. 3. Click the PivotTable button in the Tables group of the ribbon. 4. Select the data type to be analysed, viz. a table or range or, an external data source. 8. Fields can then be dragged from the Choose fields box to the areas in the bottom half of the PivotTable Fields box, to the Filters, Columns, Rows and Values boxes at the bottom of the PivotTable Fields List. 1
Use the Rows and Columns areas to summarize the data into groups. You can use both areas, if desired. Use the Values area to create summary calculations at the intersection of each row and/or column. By default, the value area will sum numeric data or count text data. These can, if desired, be changed later. Use the Filters area to filter data by selecting a value from a drop-down list. As you add fields to these boxes, Excel will construct the Pivot table by grouping data in the Row Labels field(s) into the Row area, the Column Labels field(s) in the Column area. Fields placed in the Value box will be added to the Data area and fields added to the Filters box will appear in the area above the pivot table. In the example below, Full Name has been placed in the Rows box, Type in the Columns box, Amount in the Value box and Region in the Filters box. TIP: Alternatively, items can be ticked in the Choose fields to add to report: list in the PivotTable Field list directly onto the PivotTable into the Drop Page Fields Here, Drop Column Fields Here, Drop Row Fields Here and Drop Data Items Here areas. If you decide to drag fields directly into the PivotTable areas, look out for the following symbols on the mouse pointer: Add to Row Add to Column Add to Value Add to Filters Using multiple fields 1. Additional fields can be added to the Filters, Columns, Rows and Value areas. 2. Click onto the PivotTable that you want to add fields to. This will activate the PivotTable Field List and the PivotTable Tools. 3. Drag and drop your chosen fields from the Choose fields to add to report: list into the approprate box(es) at the bottom of the PivotTable Fields List. 4. Look out for the blue/green line as as you click and drag the field over the boxes. The position of this line will affect how the data is displayed on the PivotTable. For example: 5. Will subdivide each Salesperson group into Types. 6. Whereas: 7. Will subdivide Regions into each Salesperson. Moving a field 1. If you add more than one data field into an area, you can arrange the fields in the order that you want. 2. At the bottom of the PivotTable Fields List, click the drop-down arrow at the right of the field that you want to move. 3. Select the appropriate Move (Up; Down; to Beginning; to End etc.) command. OR 4. Click and drag the field header from one box to another. For example, you could drag a field from the Columns box to the Rows box, or drag one field name above another if the area contains more than one field. Removing a field 1. Click and drag the field header out of the PivotTable fields box. The following symbol next to the mouse pointer will indicate that it is in the right position for the field to be removed. 2. OR: 3. At the bottom of the PivotTable Field List, click the drop-down arrow at the right of the field that you want to remove. 4. Select Remove Field. 2
Organising PivotTable Data Filtering When a PivotTable has been created, items can be hidden from the Row or Column areas by clicking the drop down arrow at the end of the heading and unchecking items to be hidden or shown. Remember to click OK. Viewing underlying records The Page area may be used in a similar way but selecting an entry from the list will filter out all data not meeting this criteria when you click OK. Double clicking a value in the Data area, will give you a breakdown of the figures used to make up the value on a separate sheet. Sorting By default, data will be shown in ascending order for numbers or A-Z for text. If you amend or add new data you may wish to re-sort data or adjust the sort order. 1. Click the drop-down arrow at the right of the field header that you want to sort on. 2. Click Sort A to Z, Sort Z to A or More Sort Options Pivot table Options Additional options for fine-tuning and setting preferences for how your PivotTable works can be found by: 1. Clicking the Analyze tab of the PivotTable Tools on the Ribbon. 2. Clicking the Options button in the PivotTable group. 3. Two of the most useful of these are: 4. Totals & Filters tab - Show grand totals for rows (or column). This allow you to decide whether each row or column of data has a total at the right (for rows) or at the bottom (for columns). 5. Data tab - Refresh data when opening the file. This will automatically refresh its view of the data when you open the workbook. Please note that this will not automatically extend the data range to new data (see Adding data to your PivotTable, later in this guide). Modifying the Value Field s Calculations By default, in the Value area, numeric values are summed and text values are counted. The get the PivotTable to carry out a different calculation on the data: 1. At the bottom of the PivotTable Fields List, click the down-arrow at the right of the value field button. 2. Select Value Field Setting. 3. From the Summarize values by: list select the type of calculation required 4. Click OK. 5. OR 6. Right-click one of the values and select Summerize Data By Multiple Data fields You can add a field more than once to the Data area and set the first instance to sum and the second to count so as to show the total value and the number of instances 1. In the PivotTable Fields List, add the field for the second calculation to the Value area. 2. Click the down-arrow at the right of the value field button. 3. Select Value Field Setting. 4. From the Summarize values by: list select the type of calculation required. NB: The field summary heading will change e.g. from Sum of <,field name> to Count of <field name>. 3
Adding Data to your PivotTable When you amend any of the data within the range of data currently being used to generate the PivotTable or Chart you must refresh the PivotTable. If you add extra data to the range you will need to adjust the PivotTable s data range. Refreshing data 1. Select any cell on the PivotTable. 2. Click the Options tab in the PivotTable Tools section of the Ribbon. 3. Click the Refresh button in the Data group. NB: The button has a drop-down arrow from which you can select Refresh All. This will refresh ALL PivotTables in the workbook which are based on the same source data as the selected one. 4. The PivotTable(s) will be re-drawn to show the amended data Adding data When you created the Pivot Table you specified a range of data to be plotted. If you add new data at the end of your list, you will need to adjust the PivotTable s data range. Merely using the Refresh button does not do this! 1. Select any cell on the PivotTable 2. Click the Options tab in the PivotTable Tools section of the Ribbon. 3. Click Change Data Source in the Data group. 4. Type or re-select the data range upon which to base the amended Pivot Table. Formatting a Pivot Table A PivotTable can be formatted like any other spreadsheet. If you format cells, then check that the Pivot Table option Preserve cell formatting on update is turned on. AutoFormatting a PivotTable 1. Select a cell on the PivotTable 2. Select the Design tab in the PivotTable Tools section of the ribbon. 3. Click a button in the PivotTable Styles group of the ribbon. Tip: Moving the mouse pointer over the styles will preview the style on the PivotTable. The style, however, is only applied when the button is clicked. 4. Fine-tune a style by checking and/or unchecking the tick boxes in the PivotTable Style Options group of the ribbon. Tip: To reset the PivotTable style to the default, select the None style in the top left of the PivotTable styles button. Pivot Charts A Pivot Chart is an interactive graphical representation of the data in a Pivot able. You can rearrange the layout, select a different type of chart, and add or remove data. Creating a PivotChart from scratch 1. Select any cell within the range of data. 2. Select the Insert tab. 3. Click the PivotChart button in the Charts group 4. Select the data type to be analysed, viz. a table or range or, an external data source. TIP If using an Excel table or range, Excel will automatically pick up the range to be analysed as long as your data is in a recognised list format (see, Creating a data source in Excel earlier in this guide). This can be adjusted manually, if required. 1. Select where you want the PivotChart placed, viz. a new worksheet or, the existing worksheet. If selecting the existing worksheet, you must also specify the cell into you want the top left-hand corner of the PivotChart to be placed. 2. Click OK. 3. The area for the PivotChart will then be displayed on the sheet, together with the PivotTable Field List, a PivotChart Filter Pane and a PivotChart Tools section at the right of the ribbon tabs. NB: As well as the new PivotChart a new PivotTable will have been created, the two are permanently linked 1. Fields can then be dragged from the Choose fields to add to report: list in the PivotTable Field list, to the Filters, Legend (Series), Axis(Categories), and Values boxes at the bottom of the PivotTable Field List. Use the Axis Fields area to specify what the PivotChart groups and displays along the horizontal (x) axis. 4
Use the Legend (Series) area to specify what the PivotChart groups and displays as columns for each category in the Axis field. Use the Values area to specify what the PivotChart uses to determine the height of each column against the vertical (y) axis. By default, the value area will sum numeric data or count text data. This can, if desired, be changed later. Use the Filter to filter data by selecting a value from the drop-down list which subsequently appears in the top-left of the chart In the example below, Full Name has been placed in the Axis Fields box, Region in the Legend box, Amount in the Value box and Type in the Report Filter box. Creating a Pivot Chart from an existing PivotTable 1. Click any cell on the PivotTable 2. Select the Analyze tab in the PivotTable Tools section of the ribbon. 3. Click the PivotChart button in the Tools group of the ribbon. 4. Select the type of chart that you want to create. 6. Any change made to the PivotTable will be reflected in the PivotChart and vice versa Filteringand/or Sorting Values Within the Chart. Filter buttons will be available from within the chart area 1. Click the down-arrow for the part of the PivotChart that you want to filter or sort. 2. Select your preferences. 3. If hiding or un-hiding items, remember to click OK. Multiple fields As with a PivotTable, you can place multiple fields in any PivotChart area. As you drag the field over the different areas at the bottom of the PivotTable Field List, look out for the blue bar to indicate where the field will go because this will affect the final result. For example, arranging the Axis fields as follows: Will result in the following PivotChart: 5 Whereas arranging the axis fields thus: Will produce the following: Formatting the PivotChart Once you have created your PivotChart you may wish to carry out changes to its structure and layout. Use for this purpose, the Analyze, Design and/or Format tabs in the PivotChart Tools section of the ribbon. For further information on how to use these tools, refer to the Charting in Excel 2013 Quick Reference Guide. Refreshing a PivotChart 1. Click on the PivotChart. 2. Click the Refresh button in the Data group of the PivotTable Tools section of the ribbon. Tip: If the PivotChart has been created from an existing PivotTable, the PivotChart will automatically refresh whenever the PivotTable upon which it is based is refreshed.