数据透视表:汇总具有相似数据的多个列

时间:2014-09-23 08:19:44

标签: excel pivot-table

我正在创建数据透视表以汇总excel文件中的调查回复数据。

部分数据显示“x对您有多重要?”问题的答案:

| Subject A | Subject B | Subject C | Subject D | Subject E |
-------------------------------------------------------------
| Very      | Not at all| A little  | Very      | A little  |
| Not at all| Not at all| Very      | N/A       | Very      |
| Not at all| Not at all| Very      | Very      | N/A       |
| Very      | Not at all| Not at all| Very      | A little  |
| N/A       | Not at all| Very      | Very      | A little  |

在我的数据透视表中,我想分别总结每个主题每个答案的出现次数:

             | Subject A | Subject B | Subject C | Subject D | Subject E |
--------------------------------------------------------------------------
| Very       | 2         | 0         | 3         | 4         | 1         |
| A little   | 0         | 0         | 1         | 0         | 3         |
| Not at all | 2         | 5         | 1         | 0         | 0         |
| N/A        | 1         | 0         | 0         | 1         | 1         |

我花了一些时间试图找到一种方法来做到这一点,但无济于事。谷歌也没有特别的帮助。这是因为数据透视表根本不支持这种摘要,还是只需要更多咖啡?任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

您应该首先规范化您的数据。具体而言,this article中关于数据库规范化的描述为"消除同一表中的重复列"。 而不是有五个答案列(每个主题一个),每行代表一个主题的一个问题的一个答案。

| Question   | Subject   | Answer     |
---------------------------------------
| Question 1 | Subject A | Very       |
| Question 1 | Subject B | Not at all |
| Question 1 | Subject C | A little   |
| Question 1 | Subject D | Very       |
| Question 1 | Subject E | A little   |
| Question 2 | Subject A | Not at all |
| Question 2 | Subject B | Not at all |
| Question 2 | Subject C | Very       |
| Question 2 | Subject D | N/A        |
| Question 2 | Subject E | Very       |
| Question 3 | Subject A | Not at all |
| Question 3 | Subject B | Not at all |
| Question 3 | Subject C | Very       |
| Question 3 | Subject D | Very       |
| Question 3 | Subject E | N/A        |
| Question 4 | Subject A | Very       |
| Question 4 | Subject B | Not at all |
| Question 4 | Subject C | Not at all |
| Question 4 | Subject D | Very       |
| Question 4 | Subject E | A little   |
| Question 5 | Subject A | N/A        |
| Question 5 | Subject B | Not at all |
| Question 5 | Subject C | Very       |
| Question 5 | Subject D | Very       |
| Question 5 | Subject E | A little   |

使用如下设置的数据透视表,您应该得到所需的结果。

Column Labels: Subject
Row Labels:    Answer
Values:        Count of Question

答案 1 :(得分:0)

在左侧插入一列,并向下复制=Row()以适应。 Unpivot(例如see)。删除左侧列,并使用Column进行COLUMNS,Value进行ROWS,使用值数进行Σ值。