查找列中的项目计数,然后添加另一列中的值 [英] Find count of items in column and add the values from another column

查看:76
本文介绍了查找列中的项目计数,然后添加另一列中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表中有两列(A和B).列A具有项目名称,列B具有数量.我想对所有具有相同名称的项目的数量求和.示例:

I have two columns in a table (A and B). Column A has an item name and Column B has a quantity. I want to sum the quantities for all the items that have the same name. Example:

Item        |  Quantity
------------+----------
Red Hat     |         3
Green Shirt |         9
Red Hat     |         4
Blue Pants  |         6
Blue Pants  |         3
Green Shirt |        12

,我想在具有此功能的表中添加一列:

and I would like to add a column to the table that has this:

Item        |  Quantity  |  Total
------------+------------+-------
Red Hat     |         3  |      7
Green Shirt |         9  |     21
Red Hat     |         4  |      7
Blue Pants  |         6  |      9
Blue Pants  |         3  |      9
Green Shirt |        12  |     21

我希望能够按总数量最多的项目对表格进行排序(将其按项目名称分组,因此,如果两个项目的总数量相同,我希望将它们分别分组). >

I want to be able to sort the table by the items that have the most total quantity (keeping it grouped by the item name, so if two items have the same total quantity, I would like them grouped separately).

推荐答案

尝试SUMIF函数.参见 http://www.techonthenet.com/excel/formulas/sumif.php有关更多详细信息.

Try the SUMIF function. See http://www.techonthenet.com/excel/formulas/sumif.php for more details.

更具体地说,单元格C1的公式应为:

More specifically, the formula for cell C1 should be:

=SUMIF(A:A,A1,B:B)

假设A和B列分别是项目和数量.

Assuming columns A and B are item and quantity respectively.

这篇关于查找列中的项目计数,然后添加另一列中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆