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
v
a
P
e
r
t
h
P
a
s
t
ie
s
Q
u
e
s
o
C
a
b
r
a
le
s
Q
u
e
s
o
M
a
n
c
h
e
g
o
L
a
P
a
s
t
o
r
a
R
a
c
le
t
t
e
C
o
u
r
d
a
v
a
u
lt
R
a
v
io
li
A
n
g
e
lo
R
h
n
b
r
u
K
lo
s
t
e
r
b
ie
r
R
d
K
a
v
ia
r
R
g
e
d
e
s
ild
R
s
s
le
S
a
u
e
r
k
r
a
u
t
S
a
s
q
u
a
t
c
h
A
le
S
c
h
o
g
g
i
S
c
h
o
k
o
la
d
e
S
c
o
t
t
is
h
L
o
n
g
b
r
e
a
d
s
S
in
g
a
p
o
r
e
a
n
H
o
k
k
ie
n
F
r
ie
d
M
e
e
S
ir
R
o
d
n
e
y
's
M
a
r
m
a
la
d
e
S
ir
R
o
d
n
e
y
's
S
c
o
n
e
s
S
ir
o
p
d
'
r
a
b
le
S
p
e
g
e
s
ild
S
t
e
e
le
y
e
S
t
o
u
t
T
a
r
t
e
a
u
s
u
c
r
e
T
e
a
t
im
e
C
h
o
c
o
la
t
e
B
is
c
u
it
s
T
h
r
in
g
e
r
R
o
s
t
b
r
a
t
w
u
r
s
t
T
o
f
u
T
o
u
r
t
i
r
e
T
u
n
n
b
r
d
U
n
c
le
B
o
b
's
O
r
g
a
n
ic
D
r
ie
d
P
e
a
r
s
V
a
lk
o
in
e
n
s
u
k
la
a
V
e
g
ie
-
s
p
r
e
a
d
W
im
m
e
r
s
g
u
t
e
S
e
m
m
e
lk
n
d
e
l
Z
a
a
n
s
e
k
o
e
k
e
n
Total
Sum of Quantity
Order Details Extended_ProductName
Page 1 of 12
ITS Training Class
PivotTables and Charts in Excel
current worksheet. If it does not, click on the little button on the right of the range box. Select the
8.
We will be using the data from the Microsoft sample company Northwind Traders. I exported the Orders
that Northwind Traders fulfilled over three years. The data is in one Excel worksheet. We are going to use
the PivotTable and Chart tool to see how Northwind Traders are doing.
Exercise 1: How is Business?
1. Open the Northwind Sample.xls workbook
2. You should see only 1 worksheet in this workbook. The worksheets name is Warehouse Orders.
3. Go to Data in the Excel menu
4. Look for PivotTable and PivotChart Report in the drop down menu
5. You are now in the PivotTable and PivotChart wizard. In 3 steps, you will be able to create a
PivotTable and PivotChart. The first thing is to tell Excel where the data is coming from. Since
the data for this example is in a single worksheet, we will select Excel List or Database.
In the lower part of the window, tell Excel what you want to it to do. You have the choice of
running just the PivotTable report (does not include the Chart) or the PivotChart report (includes
the PivotTable report). Please select PivotChart report (with PivotTable report).
6. Click on Next
7. Step 2 is to tell Excel where the data is. Excel might be smart enough to automatically select the
worksheet with the data and the range. Range defines the cells where the data is stored. In the
example, we have data in cells A1 to F2156. This means that we have selected 6 columns (A
through F) and 2156 rows.
Click on Next
Click here to select a
different worksheet or
area for the data
Page 2 of 12
ITS Training Class
PivotTables and Charts in Excel
9. Step 3 is where you would define the layout for the PivotTable and which fields to analyze. The
first choice is where the PivotTable should be displayed. You will probably choose to place the
PivotTable in a new worksheet. If you select Existing Worksheet, you will have to select a blank
section of the current worksheet. Please select New Worksheet.
10. Click on the Layout button. This is where you will tell Excel what to analyze. There are a few
things that you need to know before you set this up. There are 4 sections for the PivotTable. The
first is the Page. The page is used when you have an overall field such as date or categories to
include in the analysis. The Row and Column can be used to display the common fields that are
directly tied to the field that you put in the DATA section. The DATA section is where you
would calculate or count the items that correspond to the fields in Row and Column.
11. You will need to plan out what you want to analyze
before continuing on. For the exercise, we want to see
the total number of products sold by categories. To
place the fields on the right into the PivotTable area,
you would left click and hold the mouse button on the
field name. Drag the name to the area that you want
Page, Row, Column, or Data. Click and drag Category
to the Row area.
Page 3 of 12
ITS Training Class
PivotTables and Charts in Excel
12. Click and drag Quantity to the Data area.
13. The marker for the Quantity will say Sum of Quantity. In
this case, this is what we want done. If we wanted to use
a different function, you would have to double click on
the Sum of Quantity marker and make a selection from
the list of functions. You may also select the formatting
for the numbers. If you want to change the format for the
numbers, click on the Number button and make a
selection from the list.
14. We have enough information to start our PivotTable.
Click on Next. You should be back to the Step 3 of the
wizard window.
15. Click on Finish. Excel will create the PivotTable and
PivotChart.
We can see from the chart that Northwind Traders are not doing badly in sales.
Page 4 of 12
ITS Training Class
PivotTables and Charts in Excel
Now, what if the chart is ugly and not in the format that you want, you can format the chart. We will do
some simple formatting.
Exercise 2: Format the Chart
1. We want the number to have the comma to denote
thousands. Double click on the vertical axis or line. You
may choose to the pattern of the line, scale, font, number,
and alignment. Select the number tab and select Number.
Make sure the Use thousand separator (,) is checked. Also,
be sure that the Decimal places value is 0.
2. Since none of the totals are greater than 10,000, we want
the highest number to be 10,000 and not 12,000. Click on
the scale tab. The scale is set to automatic. Uncheck the box
for automatic for maximum. In the box, type in 10000.
3. Click on OK.
4. You will see that the chart has changed
What if the final results for the PivotTable and PivotChart are not what we expected to see, what should
you do? First you should check the data and make sure that you are choosing the correct fields. Second,
you can add or remove the fields that you see displayed in the PivotTable. The PivotChart is tied directly
to the PivotTable so the changes that you make in the PivotTable will automatically be changed in the
PivotChart.
Exercise 3: What if?
1. We see that the Category field values are not descriptive enough. We need to see the Description
field and get rid of the Category field. Click and drag the Description marker in the PivotTable
field list window to where the Category marker is on the PivotTable.
2. You should see the Description marker go in front of the Category marker. To remove a field,
click and drag the Category marker to the PivotTable field list window.
3. You should see the PivotTable change because of the sort order.
Page 5 of 12
ITS Training Class
PivotTables and Charts in Excel
Now the PivotTable and the PivotChart is giving us the correct information. There is one thing missing.
We do not know which product is the best seller for each category. If we use the Product name field in the
PivotTable, we will end up with a very messy chart. How can we break up the displayed information
without editing the worksheet with the data? This is a perfect time to use Page field.
Exercise 4: How good are the products selling?
1. We want to put the Description field in the Page field. Click and drag the Description marker to
the 2 rows above top of the PivotTable.
2. Click and drag the Product Name marker from the PivotTable field list to the cell beneath the
Sum of Total field (marker).
3. Now, look at the PivotChart
4. Yes, the chart is hard to read and very ugly.
5. Look at the chart and find the Description marker. You will see the word (All) in a box next to
Description. Click on the down arrow.
6. You should see a list of the category descriptions. The
word all means to display everything. Select Cheeses from
the list.
7. Click on OK.
8. You will see that the ugly chart disappears and only the
Cheese products are displayed.
9. Repeat Steps 5-6 but select Seaweed and fish instead of
Cheeses.
Page 6 of 12
ITS Training Class
PivotTables and Charts in Excel
We have use the PivotTable and PivotChart on a single location for data. Now we will do a PivotTable
from multiple workbooks and consolidate the information into a summary worksheet. We have 3
workbooks Northwind Order 1996, Northwind Orders 1997, and Northwind Orders 1998. The 3
workbooks have the same fields but each workbook holds the order data for the specified year.
We do not need to copy the worksheets into a single workbook. We can tell the PivotTable tool to go to
those workbooks and grab the data that we need to use. We do need to have the workbooks open.
Exercise 5: How is Business?
We are going to repeat Exercise 1 but with different choices. Please refer to the screen shots in Exercise 1
if you need to follow along.
1. Create a blank workbook.
2. Open the 3 workbooks (Northwind Order 1996, Northwind Orders 1997, and Northwind Orders
1998).
3. Select the new workbook that you just created.
4. Click on Data in the Excel menu.
5. In the drop down menu, select PivotTable and PivotChart report.
Step 1 select the Multiple Consolidation ranges and select PivotChart report (with PivotTable
report).
6. This is an extra window. In Step 2a, you are being asked to set up the Page field. If you are not
sure what the Page field should be, let Excel Create one for you. Select Next.
7. In Step 2b, you will need to define the workbooks and the ranges to analyze. You may type in the
workbook names and the ranges if you know what they are. OR you can use the button on the
right of the Range box to select the workbooks and the ranges. I circled the button in the picture.
8. When the window shrinks, you may select the first workbook and the range.
9. Select Northwind 1998 workbook and select the Range A1 to J 692. The workbook and range
information will automatically appear in the range box. To add it to the PivotTable and
Page 7 of 12
ITS Training Class
PivotTables and Charts in Excel
PivotChart Wizard, you need to click on the button again and then select Add. Your Step 2b
window should look like this:
[Northwind Orders 1998.xls]Orders 1998!$A$1:$J $692
1998.xls]Orders 1998!$A$1:$J $692
10. Repeat steps 7 and 8 for the other 2 workbooks. Workbook Northwind 1997 has a range of A1 to
J 1060. Northwind 1996 has a range of A1 to J 406.
11. After you are done, your Step 2b window should look like this:
96.xls]Order 1996!$A$1:$J $406
12. Click on Next
13. Select New worksheet
14. Select Finish
Excel will create PivotTable and a PivotChart but it is incomprehensible. We will need to narrow down
our fields and re-arrange our data. We would need to make sure that the fields we want to analyze are
together in the worksheet. Its most convenient if the fields you want line up starting in Column A.
Page 8 of 12
ITS Training Class
PivotTables and Charts in Excel
In order for us to get the information that we want, we need to set up 3 PivotTables in the new workbook
xercise 6: Revision of Exercise 5: How is Business?
orthwind Orders 1996, Northwind Orders 1997, and Northwind Orders
3. heet1 of the new workbook.
tTable and PivotChart reports
ard.
ge. Click on the button next to the range box.
. You should be back in the wizard.
orksheet.
ategoryName to Row.
ooks. The range for 1997 is A1 to B1060. The range for
19. tTables worksheets in the new workbook that you created earlier.
21. s. Insert a
22. nu.
tTable and
24. lidation Ranges and select
25. me and
26. nges that you want to summarize.
, and
.
27.
orksheet and select Layout.
fields are each worksheet, the Column is the
30. should look and the PivotChart.
one for each of the Northwind Orders workbooks. We will select the fields that we want to see in the
bigger PivotTable and PivotChart report. The fields that we want to select are Quantity and
CategoryName.
E
1. Create a new workbook.
2. Open the 3 workbooks N
1998.
Go to S
4. Select Data from the Excel menu.
5. In the drop-down menu select Pivo
6. Select Microsoft Excel List or Database and PivotTable report in wiz
7. Select Next.
8. Select the ran
9. Select the workbook Northwind Orders 1998.
10. Select cells A1 to B692.
11. Select the range box again
12. Select Next.
13. Select New W
14. Select Layout.
15. Click and drag C
16. Click and drag Quantity to Data.
17. Select OK and then Finish.
18. Repeat steps 3-17 for the other 2 workb
1996 is A1 to B406.
Now you have 3 Pivo
20. Rename each worksheet to the year that is assigned to the workbook. You should have 3
worksheets - 1996, 1997, and 1998.
We want to analyze the 3 PivotTable
new worksheet or use one of the blank
worksheets in the workbook.
Select Data from the Excel me
23. In the drop-down menu, select Pivo
PivotChart reports
Select Multiple Conso
PivotChart with PivotTable report.
Select Create a Single Page field for
1996!$A$4:$B$12
1997!$A$4:$B$12
1998!$A$4:$B$12
select next.
Select the Ra
In this case, we want to look at the 3
PivotTables in worksheets 1996, 1997
1998. Select the first range and click on Add
Repeat this step for the other 2 worksheets.
Select Next.
28. Select New w
29. The layout should be selected already. The Page
PivotTable total, and the Row is the CategoryName.
Select Ok and then Finish. This is how the PivotTable
Page 9 of 12
ITS Training Class
PivotTables and Charts in Excel
Page 10 of 12
ITS Training Class
PivotTables and Charts in Excel
TIPS on Charts
Charts should be simple and represent the data. It is very easy to manipulate a chart so that it
embellishes on the truth. Please be careful.
There are many different kinds of charts and Excel gives you a wide variety.
However, some charts just cannot represent the data. For example, if you are comparing the
number of apples you sold versus the monthly cost of running the farm, a pie chart is not a good
chart to use because you are graphing 2 items across a third factor (time). The line chart would be
a better choice.
You can change the PivotChart reports to any of the chart types offered by Excel. J ust Right click
on the chart and select Chart Type from the pop-up menu. You should see the list of charts and
different styles.
Here is an example of a Pie chart for Exercise 6.
You may customize the way the data is represented on a chart. For example, I want Excel to
display the totals on the chart.
Page 11 of 12
ITS Training Class
PivotTables and Charts in Excel
Exercise 7: Customize the series
1. Right click on the first bar in the chart
2. A pop-up menu should appear. Select Format Data Series.
3. You may customize the series from this window.
4. We want to select the Data Labels tab.
5. Select Value and select OK
6. The chart will have the values that we see in the PivotTable on the Chart.
Page 12 of 12