Skip to main content

Excel Pivot table

最近在重构一个项目,开发已经完成,为了给用户和PM展示数据前后的变化,会用到很多报表工具,今天介绍的pivot table就是一个很好用工具,可以很详细的展示不同维度的数据总和。下面就简单介绍一下:

Pivot tables are one of Excel’s most powerful features. A pivot table allows you to extract the significance from a large, detailed data set.

Our data set consists of 214 rows and 6 fields. Order ID, Product, Category, Amount, Date and Country.

字节码

Insert a Pivot Table
To insert a pivot table, execute the following steps.

1. Click any single cell inside the data set.
2. On the Insert tab, click PivotTable.

字节码
The following dialog box appears. Excel automatically selects the data for you. The default location for a new pivot table is New Worksheet.

3. Click OK.
字节码

Drag fields
The PivotTable field list appears. To get the total amount exported of each product, drag the following fields to the different areas.

1. Product Field to the Row Labels area.
2. Amount Field to the Values area.
3. Country Field to the Report Filter area.
字节码

Below you can find the pivot table. Bananas are our main export product. That’s how easy pivot tables can be!
字节码
Sort
To get Banana at the top of the list, sort the pivot table.

1. Click any cell inside the Total column.
2. The PivotTable Tools contextual tab activates. On the Options tab, click the Sort Largest to Smallest button (ZA).

PivotTable Tools Contextual Tab

Result

Filter
Because we added the Country field to the Report Filter area, we can filter this pivot table by Country. For example, which products do we export the most to France?

1. Click the filter drop-down and select France.
Result. Apples are our main export product to France.

Filtered Pivot Table
Note: you can use the standard filter (triangle next to Product) to only show the totals of specific products.

Change Summary Calculation
By default, Excel summarizes your data by either summing or counting the items. To change the type of calculation that you want to use, execute the following steps.

1. Click any cell inside the Total column.
2. Right click and click on Value Field Settings…

Value Field Settings

3. Choose the type of calculation you want to use. For example, click Count.

Summarize Value Field By

4. Click OK.
Result. 16 out of the 28 orders to France were ‘Apple’ orders.

Two-dimensional Pivot Table
If you drag a field to the Row Labels area and Column Labels area, you can create a two-dimensional pivot table. For example, to get the total amount exported to each country, of each product, drag the following fields to the different areas.

1. Country Field to the Row Labels area.
2. Product Field to the Column Labels area.
3. Amount Field to the Values area.
4. Category Field to the Report Filter area.

Create Two-dimensional Pivot Table

Below you can find the two-dimensional pivot table.

Two-dimensional Pivot Table in Excel

To easily compare these numbers, create a pivot chart and apply a filter. Maybe this is one step too far for you at this stage, but it shows you one of the many other powerful pivot table features Excel has to offer.

Pivot Chart
字节码

很好用的一个工具!