bta3o1 – productivity software – unit 2:

20
BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 1 of 11 MS EXCEL 2003 PIVOT TABLES Pivot Tables Although Excel is usually used for calculations, it can also be used to keep lists” to store data. An Excel list is really a database and is arranged like an Access table with each column as a field and each row as a record. (See the example below.) Pivot tables enable you to quickly analyze the data in an Excel list in many complex ways. As you will see, an Excel pivot table is very much like an Access cross-tab query. Ex. 1 Creating a pivot table 1. Create the Excel worksheet as illustrated below, naming it pivotClothing.xls. Notice that it is arranged as a list. . Can you think of a way to find answers to questions such as: How many units per style are scheduled for delivery for each month? How many units for each style are being ordered? How many units for each size are being ordered? How much has each customer ordered each month and in total? Even with just a dozen records as above, you cannot find the answers by inspecting the worksheet visually. And trying to create answers by sorting, BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 1 of 11

Upload: api-26077977

Post on 18-Nov-2014

143 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 1 of 11

MS EXCEL 2003

PIVOT TABLES

Pivot Tables

Although Excel is usually used for calculations, it can also be used to keep “lists” to store data. An Excel list is really a database and is arranged like an Access table with each column as a field and each row as a record. (See the example below.)

Pivot tables enable you to quickly analyze the data in an Excel list in many complex ways. As you will see, an Excel pivot table is very much like an Access cross-tab query.

 Ex. 1  Creating a pivot table

1. Create the Excel worksheet as illustrated below, naming it pivotClothing.xls. Notice that it is arranged as a list.

.

Can you think of a way to find answers to questions such as:

How many units per style are scheduled for delivery for each month?

How many units for each style are being ordered?

How many units for each size are being ordered?

How much has each customer ordered each month and in total?

Even with just a dozen records as above, you cannot find the answers by inspecting the worksheet visually. And trying to create answers by sorting, filtering, subtotalling and totalling would be a very laborious and time-consuming task.

Pivot tables make the job easy.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 1 of 11

Page 2: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 2 of 11

MS EXCEL 2003

PIVOT TABLES

2. Place your cursor in the data.

3. Select Data / Pivot Table and Pivot Chart Report. The Pivot Table and Pivot Chart Report Wizard opens.

Notice that you are in Step 1 of 3.

4. Click on Next to accept the defaults (Microsoft Excel list or database; PivotTable).

5. In Step 2, accept the default selection of $A$1: $K$13 for the range of data.

Notice that Excel recognizes and highlights your entire data area (list), including the header rows. (Remember, your cursor must be in the data area before you can create a pivot table.)

6. In Step 3, accept New worksheet as the location of the pivot table.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 2 of 11

Note: Your cursor must be in the data to work with a pivot table.

Page 3: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 3 of 11

MS EXCEL 2003

PIVOT TABLES

7. Click Finish.

8. Step 4 sets up a matrix for the rows and columns of the pivot table (see illustration below).

The middle section marked Drop Data Items Here is the area where calculated values (sum, average, count, etc.). We will use only sums, the most common use of pivot tables.

Now let’s try answer our first question: How many units per style are scheduled for delivery by month?

From the PivotTable Field List we will drag the Style and Delivery Month fields and drop them into the areas labelled Drop Column Fields Here and Drop Row Fields Here.

From the PivotTable Field List we will drag the Quantity field into the area labelled Drop Data Items Here.

Note:

Always place a numerical field in the body (Drop Data Items Here).

Always place non-numerical fields in the row and column area.

9. From the PivotTable Field List drag the Delivery Month data field to the area labelled Drop Column Fields Here.

10. From the PivotTable Field List drag the Style data field into the area labelled Drop Row Fields Here.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 3 of 11

Page 4: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 4 of 11

MS EXCEL 2003

PIVOT TABLES

Notes:

Why doesn’t Style go into the Column section?

There is no rule about whether a non-numeric field must go into a column or a row. You can try both to see which produces a result easier to read. Normally people like to read a spreadsheet with few columns and many rows.

In our example, Style can have thousands of values, so Style fits best into the Row section. Delivery Month has just 12 possible values, so it is better suited to the Column section.

11. Drag the Quantity field into the section labelled Drop Data Items Here. It appears in the pivot table labelled Sum of Quantity. You now see the finished pivot table and its toolbar (see illustration below).

12. Save the file.

 Ex. 2  Creating a pivot table: an easier method?

The above method is the normal way of creating a pivot table, but it does require you to have a clear idea of what your table will look like before you begin to create it. Now we will use a somewhat different method that allows us to watch the pivot table being built piece by piece. Some people find it easier to understand the process this way.

1. Highlight the data in the worksheet from the previous exercise, copy it, open a new file, and paste the data.

This prevents the confusion of creating a pivot table for a worksheet where a previous pivot table already exists.

2. Save the file as pivotClothing2.xls

3. Select columns A to K.

4. Choose Format / Column / Autofit Selection.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 4 of 11

Once the pivot table is created, you can refresh the data, change the Row, Column or Data fields and modify the formatting.

Page 5: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 5 of 11

MS EXCEL 2003

PIVOT TABLES

5. Click in any cell within the data area.

6. Choose Data / Pivot Table and Pivot Chart Report. The Pivot Table and Pivot Chart Report Wizard opens.

7. If the warning message below opens, click on No.

8. In Step 1, accept the defaults (Microsoft Excel list or database; PivotTable).

9. Click on Next.

10. In Step 2, accept the default selection of $A$1: $K$13 for the range of data.

11. In Step 3, accept New worksheet as the location of the pivot table.

12. Click Finish.

13. Step 4 sets up a matrix for the rows and columns of the pivot table.

Now, rather than creating

14. Drag the Quantity field into the Body area (labelled Drop Data Items Here) of the pivot table. The result is that the pivot table shows a field labelled Sum of Quantity, a Row header labelled Total, a Column header labelled Total, and a number representing the total for all Styles and all Delivery Months.

At this stage the numbers are not analyzed in any useful way.

15. Let’s break the total down by Delivery Month. From the PivotTable Field List drag the Delivery Month field to the Column header area next to the Sum of Quantity field (that is, on top of Total). Now the pivot table shows all the months (March, April, May) of the Delivery Month field as column headers and a separate total for each month.

This is a more useful analysis.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 5 of 11

Page 6: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 6 of 11

MS EXCEL 2003

PIVOT TABLES

16. Even more useful would be to see the numbers for each style per month. From the PivotTable Field List drag the Style field to the Row header area below the Sum of Quantity field (that is, above the Total header). Now the pivot table shows a breakdown of the data by Delivery Month and Style.

This is a very useful analysis of our data.

17. Save the file, but leave it open to continue below.

 Ex. 3  When the data changes, the pivot table must be refreshed

1. Click on the Sheet1 tab near the bottom of the screen to return to the worksheet containing the data (that is, not Sheet4 containing the pivot table).

2. In Sheet1, change all Hood11 quantities to 1,000.

3. Click on Sheet4 to return to the pivot table. Notice that it does not automatically show changes in the data. You must refresh the data. Click on the red exclamation mark on the toolbar

Or, if you forget about the Refresh button, in the PivotTable toolbar click on PivotTable and select Refresh Data.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 6 of 11

Reminder: To use the Pivot Table toolbar, your cursor must be inside the area of the pivot table.

Page 7: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 7 of 11

MS EXCEL 2003

PIVOT TABLES

The real power of pivot tables is to enable you to easily analyze your data in many different ways.

 Ex. 4  Analyzing the data by changing the fields in the pivot table

1. Return to the pivot table you created in the previous exercise, pivotClothing2.xls.

Imagine that you want to see which colours are most popular for each of the styles (Coat11, Hood11, Jacket).

2. Drag the Color field from the PivotTable Field List to the Row area, dropping it near the right edge of the Style field. Now the pivot table shows each style broken into all its colours.

Next you want to see the data focussed on the colours of your products instead of styles (perhaps you want to cut costs by eliminating unpopular colours).

3. Drag the Colour field from the PivotTable Field List to a position near the left edge of the Style field. Now the pivot table shows Colours broken into Styles.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 7 of 11

Page 8: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 8 of 11

MS EXCEL 2003

PIVOT TABLES

4. In order to see data for colours alone, drag the Style field down and off the area of the pivot table.

Perhaps you are not interested in white (you know you will always continue to sell white).

5. Click on the drop-down arrow for the Colour row field. Uncheck White. This removes the data for white.

Perhaps you are not interested in May (you believe it was an abnormal month for sales).

6. Click on the drop-down arrow for the Delivery Month row field. Uncheck May. This removes the data for May.

7. Restore the data for White and May by unchecking the boxes.

8. Drag the Delivery Month column field to the row area and the Colour row field to the column area.

Pivot tables got their name from the operation of changing a row field to a column field or vice versa, a procedure known as pivoting a table.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 8 of 11

Page 9: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 9 of 11

MS EXCEL 2003

PIVOT TABLES

9. Move Colour and Delivery Month back to their former positions.

10. Drag the Size field from the PivotTable Field List to the Row area near the right edge of the Colour row field.

11. Since white is the only colour that comes in more than 1 size, remove the data for all colours except white.

12. Restore the colours you have removed.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 9 of 11

Page 10: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 10 of 11

MS EXCEL 2003

PIVOT TABLES

 Ex. 5  Recognizing the power of pivot tables

1. Continue with the file from the previous exercises, pivotClothing2.xls.

2. Adjust the pivot table to show data for only 2 fields: Customer by Delivery Month. Now you can answer the questions

Which is your best customer over the 3 months?

Which is your second-best customer in March?

Which is your worst customer?

3. Look at the original worksheet, where the data is listed by Order#. Study the data. Can you see which is your best customer over the 3 months? Your second-best customer in March? Your worst customer(s)?

 Ex. 6  Practice with pivot tables

1. Open the given Personnel in charge dataset (personnelincharge.xls).

2. Create pivot tables to answer the following questions:

a. Who was in charge the most number of days? How many days? (ANSWER: Harry 8)

b. Who was in charge the least number of days? How many days? (ANSWER: Sue 4)

c. Who was in charge the most number of days when the activity was cards or nap? (ANSWER: Harry 6)

d. Who was in charge the least number of days when the activity was cards or nap? (ANSWER: Mr. P 1)

e. How many days was the activity cards? (ANSWER: 9)

f. How many days was the activity something other than swim? (ANSWER: 24)

 Ex. 7  Practice with pivot tables: Wildcat Bluff small mammal dataset

1. Open the given small mammal dataset created by biologists at the Wildcat Bluff Nature Center near Amarillo, Texas (Wildcat_mammal_data.xls).

2. Create pivot tables to answer the following questions:

a. number of individuals (status AN and DN combined) of each species captured on the site (ANSWER: Ch 14, Na 10, Ol 4, Pl 67, Pm 5,R. mont. 4, Sh 1)

b. total number of individuals captured on each trap line (ANSWER: B01 32, B02 33, G01 4, G02 3, M01 20, M02 17, PD02 160, R01 30)

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 10 of 11

This should convince you of the importance of pivot tables in analyzing data.

Don’t worry about what all the abbreviations mean. Pl means white-footed mice, Na means white-throated wood rats, etc.

Page 11: BTA3O1 – Productivity Software – Unit 2:

BTA3O1 – Productivity Software – Unit 2: Spreadsheet – Part 10: Pivot Tables– Page 11 of 11

MS EXCEL 2003

PIVOT TABLES

c. total number of each species captured at stations 4 and 5 combined (ANSWER: Na 9, Pl 31, Pm 2, X 7)

d. total number of females captured on trap days 3 and 4 combined (ANSWER: 109)

e. total number of males captured on trap days 1 and 2 combined (ANSWER: 67)

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software

Unit 2: Spreadsheet – Part 5: Pivot Tables – Page 11 of 11