在Excel中分组东西 [英] Grouping things in Excel
问题描述
我在Excel中有两列:
I have two columns in Excel:
1 5
1 6
2 7
3 9
4 9
4 2
我需要计算总和从第二列中的值,
在第一列中具有相同的值。这是所需的结果:
I need to compute sums from values in the second column, that have the same value in the first column. This is the desired result:
1 11
2 7
3 9
4 11
可以在Excel中完成吗?
Can this be done in Excel?
推荐答案
您可以使用数据透视表来执行此操作。在两列之上放置一个标签。选择数据并添加一个数据透视表。选择第一列作为行标签,并将第二列放在和字段中。确保该字段显示为值的总和。
You can do this using pivot tables. Place a label above both columns. Select the data and add a pivot table. Select the first column as row labels and place the second column in the sum field. Make sure that field is displayed as sum of values.
例如:
Category Value
1 5
1 6
2 7
3 9
4 9
4 2
- 选择您的所有数据标题。
- 点击插入 - >数据透视表
- 将类别拖动到行标签字段
- 拖动值到值字段
- 确保它显示为值的总和
- 如果没有,请单击它 - >值字段设置 - >将值总结为Sum
- Select all your data incl. the headers.
- Click insert --> pivot table
- Drag 'Category' to the row labels field
- Drag 'Value' to the 'Values' field
- Make sure it is displayed as 'Sum of value'
- If not, click it --> Value field settings --> Summarize values as 'Sum'
请注意,列上方的标签是必需的,因为excel需要命名列制作枢轴表。
Note that the labels above your columns are needed because excel requires named columns when making pivot tables.
这篇关于在Excel中分组东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!