Excel 数据透视表

Excel 数据透视表

我有一张包含类似以下数据的工作表:

P1_ShipType         P2_ShipType         RoundTime
Kus_AssaultFrigate  Tai_AssaultFrigate  117
Kus_AssaultFrigate  Tai_AttackBomber    17
Kus_AssaultFrigate  Tai_Carrier         1191
Kus_AttackBomber    Tai_AssaultFrigate  2775
Kus_AttackBomber    Tai_AttackBomber    18
Kus_AttackBomber    Tai_Carrier         0
Kus_Carrier         Tai_AssaultFrigate  1354
Kus_Carrier         Tai_AttackBomber    8
Kus_Carrier         Tai_Carrier         0

我如何“旋转”表格以使其看起来像这样:

                    Tai_AssaultFrigate      Tai_AttackBomber        Tai_Carrier
Kus_AssaultFrigate  117                     17                      1191
Kus_AttackBomber    2775                    18                      0
Kus_Carrier         1354                    8                       0

谢谢!

[编辑]

但是如果每个 RoundTime 有多列怎么办?

P1_ShipType             P1_Research     P2_ShipType             P2_Research     RoundTime
Kus_AssaultFrigate      guns            Tai_AssaultFrigate      guns            48
Kus_AssaultFrigate      guns            Tai_AttackBomber        guns            11
Kus_AssaultFrigate      guns            Tai_Carrier             guns            38
Kus_AttackBomber        guns            Tai_AssaultFrigate      guns            62
Kus_AttackBomber        guns            Tai_AttackBomber        guns            70
Kus_AttackBomber        guns            Tai_Carrier             guns            69
Kus_Carrier             guns            Tai_AssaultFrigate      guns            5
Kus_Carrier             guns            Tai_AttackBomber        guns            84
Kus_Carrier             guns            Tai_Carrier             guns            77
Kus_AssaultFrigate      guns            Tai_AssaultFrigate      engines         83
Kus_AssaultFrigate      guns            Tai_AttackBomber        engines         82
Kus_AssaultFrigate      guns            Tai_Carrier             engines         29
Kus_AttackBomber        guns            Tai_AssaultFrigate      engines         97
Kus_AttackBomber        guns            Tai_AttackBomber        engines         22
Kus_AttackBomber        guns            Tai_Carrier             engines         10
Kus_Carrier             guns            Tai_AssaultFrigate      engines         71
Kus_Carrier             guns            Tai_AttackBomber        engines         3
Kus_Carrier             guns            Tai_Carrier             engines         38
Kus_AssaultFrigate      engines         Tai_AssaultFrigate      guns            34
Kus_AssaultFrigate      engines         Tai_AttackBomber        guns            21
Kus_AssaultFrigate      engines         Tai_Carrier             guns            84
Kus_AttackBomber        engines         Tai_AssaultFrigate      guns            51
Kus_AttackBomber        engines         Tai_AttackBomber        guns            73
Kus_AttackBomber        engines         Tai_Carrier             guns            27
Kus_Carrier             engines         Tai_AssaultFrigate      guns            66
Kus_Carrier             engines         Tai_AttackBomber        guns            82
Kus_Carrier             engines         Tai_Carrier             guns            22
Kus_AssaultFrigate      engines         Tai_AssaultFrigate      engines         10
Kus_AssaultFrigate      engines         Tai_AttackBomber        engines         63
Kus_AssaultFrigate      engines         Tai_Carrier             engines         2
Kus_AttackBomber        engines         Tai_AssaultFrigate      engines         94
Kus_AttackBomber        engines         Tai_AttackBomber        engines         44
Kus_AttackBomber        engines         Tai_Carrier             engines         93
Kus_Carrier             engines         Tai_AssaultFrigate      engines         5
Kus_Carrier             engines         Tai_AttackBomber        engines         53
Kus_Carrier             engines         Tai_Carrier             engines         80

结果应如下所示:

                                                Tai_AssaultFrigate      Tai_AttackBomber        Tai_Carrier     Tai_AssaultFrigate      Tai_AttackBomber        Tai_Carrier
                                                guns                    guns                    guns            engines                 engines                 engines
Kus_AssaultFrigate  guns                        117                     17                      1191            117                     17                      1191
Kus_AttackBomber    guns                        2775                    18                      0               2775                    18                      0
Kus_Carrier         guns                        1354                    8                       0               1354                    8                       0
Kus_AssaultFrigate  engines                     117                     17                      1191            117                     17                      1191
Kus_AttackBomber    engines                     2775                    18                      0               2775                    18                      0
Kus_Carrier         engines                     1354                    8                       0               1354                    8                       0

答案1

您只需选择数据范围,然后在 Excel 中;

Insert--> Pivot Table.

然后选择如下所示的数据字段。

Row Lables --> P1_ShipType
Column LAble -->P2_ShipType
Values --> Round Time

请参考屏幕截图

数据透视表

输出

格式化和总删除量

数据透视表可以根据需要重新排列可用的列。以下是其中一个示例。

在此处输入图片描述

在此处输入图片描述

相关内容