Pivot Tble
Pivot Tble
With very
little effort, you can use a pivot table to build good-looking reports for large data
sets.
Sample data
The sample data contains 452 records with 5 fields of information: Date, Color, Units,
Sales, and Region. This data is perfect for a pivot table.
Data in a proper Excel Table named "Table1". Excel Tables are a great way to build
pivot tables, because they automatically adjust as data is added or removed.
Insert Pivot Table
1. To start off, select any cell in the data and click Pivot Table on the Insert tab of the
ribbon:
Excel will display the Create Pivot Table window. Notice the data range is already
filled in. The default location for a new pivot table is New Worksheet.
2. Override the default location and enter H4 to place the pivot table on the current
worksheet:
3. Click OK, and Excel builds an empty pivot table starting in cell H4.
Note: there are good reasons to place a pivot table on a different worksheet. However, when
learning pivot tables, it's helpful to see both the source data and the pivot table at the same
time.
Excel also displays the PivotTable Fields pane, which is empty at this point. Note all
five fields are listed, but unused:
To build a pivot table, drag fields into one the Columns, Rows, or Values area. The
Filters area is used to apply global filters to a pivot table. The pivot table fields pane
shows how fields were used to create a pivot table.
Add fields
1. Drag the Sales field to the Values area.
Excel calculates a grand total, 26356. This is the sum of all sales values in the entire
data set:
Excel breaks out sales by Color. You can see Blue is the top seller, while Red comes
in last:
Notice the Grand Total remains 26356. This makes sense, because we are still
reporting on the full set of data.
Let's take a look at the fields pane at this point. You can see Color is a Row field, and
Sales is a Value field:
Number formatting
Pivot Tables can apply and maintain number formatting automatically to numeric
fields. This is a big time-saver when data changes frequently.
2. Apply Currency formatting with zero decimal places, the click OK:
In the resulting pivot table, all sales values have Currency format applied:
Currency format will continue to be applied to Sales values, even when the pivot table
is reconfigured, or new data is added.
Sorting by value
1. Right-click any Sales value and choose Sort > Largest to Smallest.
Excel now lists top-selling colors first. This sort order will be maintained when data
changes, or when the pivot table is reconfigured.
Refresh data
Pivot table data needs to be "refreshed" in order to bring in updates. To reinforce how
this works, we'll make a big change to the source data and watch it flow into the pivot
table.
Note: changing F5 to $2000 is not realistic, but it's a good way to force a change you
can easily see in the pivot table. Try changing an existing color to something new, like
"Gold" or "Black". When you refresh, you'll see the new color appear. You can use
undo to go back to original data and pivot.
1. Drag Units to the Value area to see Sales and Units together:
Percent of total
There are different ways to display values. One option is to show values as a percent
of total. If you want to display the same field in different ways, add the field twice.
Note: the number format for percentage has also been adjusted to show 1 decimal.
Here is the Fields pane at this point:
Pivot Chart
A pivot chart is the visual representation of a pivot table in Excel. Pivot charts and pivot tables are connected
with each other.
Below you can find a two-dimensional pivot table. Go back to Pivot Tables to learn how to create this pivot
table.
3. Click OK.
Below you can find the pivot chart. This pivot chart will amaze and impress your boss.
Note: any changes you make to the pivot chart are immediately reflected in the pivot table and vice versa.
1. Use the standard filters (triangles next to Product and Country). For example, use the Country filter to only
show the total amount of each product exported to the United States.
3. Because we added the Category field to the Filters area, we can filter this pivot chart (and pivot table) by
Category. For example, use the Category filter to only show the vegetables exported to each country.
Change Pivot Chart Type
You can change to a different type of pivot chart at any time.
2. On the Design tab, in the Type group, click Change Chart Type.
3. Choose Pie.
4. Click OK.
Note: pie charts always use one data series (in this case, Beans). To get a pivot chart of a country, swap the
data over the axis. First, select the chart. Next, on the Design tab, in the Data group, click Switch
Row/Column.
The following steps need to be performed in order to change data sources of Pivot
Tables and Pivot Charts in MS Excel:
1. Click on any cell inside the Pivot Table or Pivot Chart generated, based on unrevised or older
data.
2. Click on Analyze Tab on Menu Bar, and further click on Change Data Source option under Data
section.
3. Choose the appropriate Data Source and click on OK.
4. Click on Refresh so that the appropriate Pivot Table and Pivot Chart are generated.
Note: It is advisable for any proficient Excel user to change data of a spreadsheet
before you insert a pivot table. This way your data source is updated automatically and
can help in saving time. However, Refresh needs to be clicked in order to generate the
updated Pivot Table and Pivot Chart.