跳到主要内容

如何在一列中将多个条件相加?

在Excel中,SUMIF函数是有用的函数,可用于汇总不同列中具有多个条件的单元格,但是使用此功能,我们还可以基于一列中的多个条件对单元格求和。 在这篇文章中。 我将讨论如何在同一列中使用多个条件对值求和。

将一列中包含多个OR条件的单元格与公式相加


箭头蓝色右气泡 将一列中包含多个OR条件的单元格与公式相加

例如,我有以下数据范围,现在,我想获得一月份产品KTE和KTO的总订单。

doc-sum-multiple-criteria-column-1

对于同一字段中的多个OR条件,请使用多个SUMIF函数:

公式1:SUMIF + SUMIF

请输入以下公式: =SUMIF(A2:A10,"KTE",B2:B10) + SUMIF(A2:A10,"KTO",B2:B10),然后按 输入 密钥,您将获得产品KTE和KTO的总价值,请参见屏幕截图:

doc-sum-multiple-criteria-column-2
-1
doc-sum-multiple-criteria-column-3

笔记:

1.在上式中 A2:A10 是您要对其应用条件的单元格范围, B2:B10 是要求和的单元格,而KTE,KTO是要对这些单元格求和的条件。

2.在此示例中,只有两个条件,您可以应用更多条件,只需在公式后添加SUMIF(),例如 = sumif(范围,条件,sum_range)+ sumif(范围,条件,sum_range)+ sumif(范围,条件,sum_range)+…

公式2:SUM和SUMIF

如果需要添加多个条件,那么上面的公式将是冗长而乏味的,在这种情况下,我可以为您提供一个更紧凑的公式来解决它。

将此公式键入一个空白单元格: = SUM(SUMIF(A2:A10,{“ KTE”,“ KTO”},B2:B10)),然后按 输入 获得所需结果的关键,请参见屏幕截图:

doc-sum-multiple-criteria-column-4

笔记:

1.在上式中 A2:A10 是您要对其应用条件的单元格范围, B2:B10 是您要求和的单元格,并且 韩国电信, 韩国旅游发展局 是您对单元格求和的标准。

2.要汇总更多条件,只需将条件添加到花括号中,例如 =SUM(SUMIF(A2:A10, {"KTE","KTO","KTW","Office 选项卡"}, B2:B10)).

3.仅当要在同一列中应用条件的范围单元格时,才能使用此公式。


高级合并行:(合并重复的行并求和/平均对应的值):
  • 1.指定要基于其合并其他列的键列;
  • 2.为您的合并数据选择一种计算。

doc-sum-columnsone-criteria-7

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!


相关文章:

如何在Excel中对一个或多个条件求和?

如何在Excel中基于单个条件求和多列?

最佳办公生产力工具

🤖 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 (20)
Rated 4.5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Queria somar em um intervalo, onde o critério está em uma coluna, mas ao chegar no critério a soma parasse.

A B
1 Amor 3
2 Paixão 4
3 Ódio 6
4 Raiva 1
5 Excel 2
6 Carro 9
7 Moto 6
8 Avião 5

Somar de Paixão até moto, mas não é fixa a quantidade linhas. Então a função teria que começar a somar em Paixão e parar a soma em Moto.

4+6+1+2+9+6 = 28
This comment was minimized by the moderator on the site
Busquei muito no Gogle uma forma de somar valores diferentes dentro da mesma coluna e com sua dica, consegui o que eu queria! Valeu!!!
Rated 4.5 out of 5
This comment was minimized by the moderator on the site
what if instead of "KTE" and "KTO" I wanna use E:1 and E:2 cells, please help

=SUM(SUMIF(A2:A10, {"KTE","KTO"}, B2:B10))
This comment was minimized by the moderator on the site
Hello, Alejandro,
To use the cell references instead of the specific text value, you just need to apply the below array formula:
=SUM(SUMIF(A2:A10,E1:E2,B2:B10))
After entering this formula, please press Ctrl + Shift + Enter keys together to get the result.
This comment was minimized by the moderator on the site
O meu problema é, em um intervalo de 5000 linhas, tenho que somar 630, mas o titulo fica na mesma coluna dos critérios
This comment was minimized by the moderator on the site
thanks this helped a lot! :)
This comment was minimized by the moderator on the site
Hi, I Need to put in a drop Down in 3 Slab for using sumif. Example Slab 1-A,2-B,3-C & Total Sumof 3 Slab Please Suggest..
This comment was minimized by the moderator on the site
Hi, I Need to Understand, How to Make the multiple criteria in sumifs function along with Total Value in a Drop Down. Please suggest. Example In a Drop Down I need to put 4 Slab (1-A,1-B,1-C & Total of (1-A,1-B,1-C) Slab. JItendra//
This comment was minimized by the moderator on the site
As shown above, we can do either =SUMIF(A2:A10,"KTE",B2:B10) + SUMIF(A2:A10,"KTO",B2:B10) or =SUM(SUMIF(A2:A10, {"KTE","KTO"}, B2:B10)) for short What if I don't want to use KTE and KTO directly in the code and use the cell they are into? How am I suppose to write the code for the short version?
This comment was minimized by the moderator on the site
=SUM(SUMIF(A2:A10, {A:5\A:8}, B2:B10))
This comment was minimized by the moderator on the site
This is what I am looking for. Help me if you got answer of this
This comment was minimized by the moderator on the site
Hi, Is there a way to use INDIRECT function, eg INDIRECT(E3), instead of using "Apple" in the SUMIF function? eg. SUM(SUMIF(A1:A5, {"Apple","Orange"}, C1:C5)) and use something like this SUM(SUMIF(A1:A5,(INDIRECT(E3),INDIRECT(E4)),C1:C5)?
This comment was minimized by the moderator on the site
I'm hoping someone can help me with this. Name Categories John 1, 5, 8, 10, 12 Mike 4, 8, 9, 11, 15 Brittany 2, 5, 14, 23 Angela 1, 6, 7, 14, 19 David 11, 10, 23 In the above scenario, the categories for each person are what would be within the brackets of a SUM(SUMIFS( formula. I am trying to create a formula that can be dragged down for my entire data set. The problem is my data set is for hundreds of people, so creating IF statements for each scenario makes the formula entirely too long. Is there any way the criteria within the brackets can be a cell reference? Or if there are any other suggestions I would greatly appreciate it. Thanks!
This comment was minimized by the moderator on the site
Is there a way to do an "AND" statement instead of an "OR" statement?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations