跳到主要内容

如何在Excel中按组对值求和?

这是两列,一列是产品名称,另一列是销售。 现在,我想用相同的产品来汇总销售量,如下图所示。 如何在Excel中解决?
第1组的文档总和

使用公式按组求和

使用 Kutools for Excel 按组计算或组合值


使用公式按组求和

您可以在Excel中轻松地使用一个公式按组对值求和。

选择数据范围的下一个单元格,键入 = IF(A2 = A1,“”,SUMIF(A:A,A2,B:B)),(A2是您要基于的相对像元,A1是列标题,A:A是要基于其求和的列,B:B是您要对这些值求和的列。) 输入 键,将填充手柄向下拖动到单元格以填充公式。
第2组的文档总和


使用 Kutools for Excel 按组计算或组合值

如果要按组进行其他计算,例如计数,查找最大值或最小值或基于组合并值,则可以尝试 Kutools for Excel高级组合行 效用。

Kutools for Excel, 与超过 300 方便的功能,使您的工作更加轻松。 

免费安装 Kutools for Excel,请执行以下操作:

1.选择数据范围,然后单击 库工具 > 合并与拆分 > 高级组合行.
第3组的文档总和

2.在 高级组合行 对话框,请按以下步骤操作:

1)指定一列作为用于计算或组合值的关键列;

2)根据需要在一个操作中选择一个选项。
第4组的文档总和

3。 点击 Ok,则将按以下屏幕截图所示计算或组合这些值:

 按组求和  按组合并
第5组的文档总和   第6组的文档总和

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
hi what if the date is also added to it and then how we can calculate total for particular item, date wise. see below
Date item qty
3-Mar-21 blue 24
3-Mar-21 green 15
3-Mar-21 green 46
3-Mar-21 Blue 54
3-Mar-21 Red 6
4-Mar-21 Red 18
4-Mar-21 Blue 21
4-Mar-21 green 39
4-Mar-21 green 52
4-Mar-21 red 35
4-Mar-21 blue 19
5-Mar-21 green 54
5-Mar-21 green 26
5-Mar-21 Blue 29
5-Mar-21 Red 31
5-Mar-21 Red 74
5-Mar-21 Blue 20
5-Mar-21 green 85
5-Mar-21 green 56
This comment was minimized by the moderator on the site
Not exactly working for me. The A1 in the A2=A1 is does not stay constant once pasted and is off always by one row. If I lock the cell, in my case =IF(A2=$A$1,"",SUMIF(A:A,A2,H:H)), The formula works but populates in every column cell.
This comment was minimized by the moderator on the site
How use =IF(A2=A1,"",SUMIF(A:A,A2,B:B))
If in coloumn A data Blue is come after black
This comment was minimized by the moderator on the site
Please Reply
This comment was minimized by the moderator on the site
You can sort the data firstly to make sure that same data together.
This comment was minimized by the moderator on the site
Sum Values By Group. Nice to have a good reference for users not familiar with excel formula scripting. I have used the same script but I cannot find a way to sort the result based on the summed values, in your example, I like to get summed valued from highest to lowest (105, 96, 83). I was able to do it by creating another column (say column D) to copy the summed amount corresponding to product (say, Blue will have 96 for D2, D3, D4 / 83 for D5, D6 and so on) then sort column D. But I think that is a crude way of doing it. Is there a built-in function in Excel or Kutools to have the sum and sort (based on summed values). Thanks
This comment was minimized by the moderator on the site
Skip the IF part and just use =SUMIF(A:A,A2,B:B)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations