Adv-Excel - VBA-5 - Pivot Table - N
Adv-Excel - VBA-5 - Pivot Table - N
Pivot Table
Using Pivot Tables to analyze data :
You might want to use a Pivot Table report if you wish to compare
related totals, especially when you have a long list of figures to
summaries and you want to compare several facts about each figure.
Because a Pivot Table report is interactive, you can change the view of
the data to see more details or calculate different summaries
ADVANCED EXCEL
Pivot Table
Using Pivot Tables to analyze data (Cont’d) :
The data area is the part of the Pivot Table report that contains
summary data. The cells of the data area show summarized data for the
items in the row and column fields. Each value in the data area
represents a summary of data from the source records or rows.
Pivot Table
Using Pivot Tables to analyze data (Cont’d) :
Row Fields Row fields are displayed on the side of the Pivot Table report;
rows can be nested within another row.
Column Field Column fields are displayed at the top of the Pivot Table report.
A Pivot Table report can have multiple column fields just as it
can have multiple row fields.
Data Item field and A data item field is a field from the data range or database
Summary functions that contains data to be summarized. The Pivot Table reports
use summary functions such as Sum, Count, and Average.
These functions also provide subtotals and grand totals
automatically, where you choose to show them.
Report Filter A Report Filter is a field that is assigned to a page or filter
orientation, it is used to filter the entire Pivot Table report when
you select an item from the drop-down list the Pivot Table
report displays the summarized data for only that item.
Pivot Table
Pivoting :
You can change the layout by dragging a field button to another part of
the Pivot Table report – e.g. move a column to a row or a row to a
column, you are transposing the vertical or horizontal orientation of the
field (this operation is called pivoting) you can view your data in different
ways and calculate different summarized values.
ADVANCED EXCEL
Pivot Table
Pivot Table Example:
The example we are going to use is simpler and part of it is shown below.
The table gives the number of pupils and staff in different types of
schools in a country district(name : schools.xls).
ADVANCED EXCEL
Pivot Table
Guidelines for creating a Pivot Table In Excel :
2. Because Excel uses the data in the first row of a data range or table
for the Field names in the Pivot Table, the source data range MUST
contain column headings.
3. To make the pivot table easier to refresh and update when the source
list or database changes, you could name the source range and use
the named range when you create the Pivot Table.
ADVANCED EXCEL
Pivot Table
Example 1 – Number of Nursery Schools in SouthWest area:
Step3 : Click on the Insert tab, in the Tables group, click on the
PivotTable button to display the Create PivotTable dialogue
box:
Pivot Table
Pivot Table
Step7 : Select Existing worksheet, then click in the Location text box
and click on cell H5 in the current worksheet to specify where you
want to start the Pivot Table.
ADVANCED EXCEL
Pivot Table
Step8 :Click on the OK button. This brings you back to the worksheet
which now has a blank Pivot Table and PivotTable Field List as shown
next: Field names from
the data range
Empty Pivot Table
because
no fields have
been selected yet
Pivot Table
Step8(Cont’d) :
Field names from
the data range
Pivot Table
At the same time, two additional, contextual tabs appear on the Ribbon
under the heading PivotTable Tools. There is an Options tab, which
should be selected, and a Design to change the appearance of the pivot
table.
● The field names in our original data range are shown in the floating
PivotTable Field List dialogue box.
● Let’s say we want to know ‘how many Nursery schools are there’.
Under Choose fields to add to report:
● Drag the required field – e.g. ‘Area’ from the list into the Column
Labels box. The column labels will be added to the pivot table.
● Drag the field ‘Type’ into the Row Labels box. Your pivot table and
field list should now look something like this.
ADVANCED EXCEL
Pivot Table
ADVANCED EXCEL
Pivot Table
The pivot table, by default, is created using the Compact Layout. At this
point, it is helpful to switch to Outline Layout, which shows the names
of the fields, instead of just saying Row Labels and Column Labels.
Pivot Table
Drag the field ‘Name’ into the Values box. Name is the appropriate field
to use if we want to know the number of schools in the South -West
area. Excel will automatically use the Count summary function.
● The Pivot Table produced should look like this, and the top left cell will
be in H5 as requested.
If you click outside of the Pivot Table, the PivotTable changes its
appearance and the PivotTable Field List disappears, click on the Pivot
Table again and the PivotTable Field List appears and so do the two
PivotTable Tools tabs on the Ribbon.
ADVANCED EXCEL
Pivot Table
If the PivotTable Field List dialogue box does not appear, switch to the
Pivot Table Tools Options tab on the Ribbon and ensure that the Field
List button in the Show/Hide group is selected.
ADVANCED EXCEL
Pivot Table
The drop-down arrows next to Type and Area (shown next) produce the
following lists of selection boxes:
If you want to see just the Nursery schools in the South West area, deselect the
other options and the Pivot Table then looks like this:
ADVANCED EXCEL
Pivot Table
Excel automatically displays Subtotals and Grand Totals; you can show or hide
the Grand Totals by clicking on the Options tab and in the Pivot Table group
select Options to open the PivotTable Options dialogue box.
Click on the Totals & Filters tab and under Grand Totals; deselect Show grand
totals for rows or Show grand totals for columns and click OK.