跳到主要内容

如何在Excel中基于过滤条件对单元格进行计数/求和?

实际上,在Excel中,我们可以使用COUNTA和SUM函数在正常数据范围内对单元格进行快速计数和求和,但是这些函数在过滤后的情况下将无法正常工作。 要基于过滤器或具有条件的过滤器对单元格进行计数或求和,本文可能会对您有所帮助。

基于带有公式的过滤器对单元格进行计数/求和

使用 Kutools for Excel 根据过滤器对单元格进行计数/求和

使用公式,根据具有特定条件的过滤器对单元格进行计数/求和


基于带有公式的过滤器对单元格进行计数/求和

以下公式可以帮助您快速,轻松地对过滤后的单元格值进行计数或求和,请这样做:

要从过滤后的数据中计算单元格,请应用以下公式: =小计(3,C6:C19) (C6:C19 是要从中进行过滤的数据范围),然后按 输入 键。 看截图:

基于过滤器1的文档计数

要基于过滤后的数据对单元格值求和,请应用以下公式: =小计(9,C6:C19) (C6:C19 是要求和的要过滤的数据范围),然后按 输入 键。 看截图:

基于过滤器2的文档计数


使用 Kutools for Excel 根据过滤器对单元格进行计数/求和

如果你有 Kutools for Excel是, 可数可见的 函数还可以帮助您同时计算和汇总过滤后的单元格。

Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用. 

安装后 Kutools for Excel,请输入以下公式以对已过滤的单元格进行计数或求和:

计数过滤的单元格:= COUNTVISIBLE(C6:C19)

对过滤后的单元格求和:= SUMVISIBLE(C6:C19)

基于过滤器3的文档计数

Tips:您还可以通过点击以下按钮来应用这些功能 库工具 > Kutools函数 > 统计与数学 > 平均/可量化/可汇总 根据需要。 看截图:

立即下载和免费试用Excel的Kutools!


使用公式,根据具有特定条件的过滤器对单元格进行计数/求和

有时,您希望在过滤的数据中根据条件进行计数或求和。 例如,我有以下过滤数据,现在,我需要计算和加总名为“ Nelly”的订单。 在这里,我将介绍一些公式来解决它。

基于过滤器5的文档计数

根据具有某些条件的过滤器数据对单元进行计数:

请输入以下公式: =SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B19,ROW(B6:B19)-MIN(ROW(B6:B19)),,1)), --( B6:B19="Nelly"))B6:B19 是您要使用的过滤数据,以及文本 耐莉 是您要依据的条件),然后按 输入 获得结果的关键:

基于过滤器6的文档计数

根据具有某些条件的过滤器数据对单元格求和:

要根据条件对C列中的过滤值求和,请输入以下公式: =SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B19,ROW(B6:B19)-MIN(ROW(B6:B19)),,1)),( B6:B19="Nelly")*(C6:C19)) (B6:B19 包含您要使用的条件,文本 耐莉 是标准,并且 C6:C19 是您要求和的单元格值),然后按 输入 键返回结果,如下所示:

基于过滤器7的文档计数

最佳办公生产力工具

🤖 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 (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
First of all, sorry for my bad English haha.

I used Skyyang's formula, but I'm still missing a small part in my formula. I entered the following formula, but it doesn’t recognize my 2nd criteria in the answer. Can you help me further? I can share the sheet if you want.

=SOMPRODUCT(((D4:D45="Auto")+(E4:E45="Zonder vervanging")*(SUBTOTAAL(3;VERSCHUIVING(E4;RIJ(E4:E45)-RIJ(E4:E45)-3;)))))
This comment was minimized by the moderator on the site
Does anybody knows how to do this but with more than one criteria? I mean, if I wanted to COUNT only the rows which qualify for two or more criterias?
Thanks a bunch!
This comment was minimized by the moderator on the site
Hello, WN,
May be the following formula can help you:
=SUMPRODUCT( ( (B2:B23="Large")+(B2:B23="Small"))*(SUBTOTAL(103,OFFSET(B2,ROW(B2:B23)-MIN(ROW(B2:B23)),0))))

If you have more criteria, just join the criteria with + character.
Please try, hope it can help you!
This comment was minimized by the moderator on the site
If i have data in sheet 1 in trying to pull into sheet 2 that comes from a range in a column i want but I'm only looking for data that had a certain value of "system issue" and i want the second sheet to be able to see how many in that column had system issue but *** up the paid amounts in a separate column of sheet one that filter to the "system issue" so we can see how much has been paid out for system issues, thoughts on the formula? The one you keep sharing is only for 1 sheet and you keep using a number after the first parenthesis that i do not know how you came up with it.
This comment was minimized by the moderator on the site
Can this be done with more than one criteria? I mean, I know it can be as per the below answered questions. I have to have sum based on two criteria's One criteria in Row B as "RN" and another one in row DX as "D" and the sum is going to be in row EA. Any help would be great!
This comment was minimized by the moderator on the site
Does anybody knows how to do this but with more than one criteria? I mean, if I wanted to SUM only positive values?
This comment was minimized by the moderator on the site
Hi, Bernardo,
To solve your problem, you should apply below formula:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(B2,ROW(B2:B14)-ROW(B2),0)),--(A2:A14="Lucy"),--(B2:B14>0))

Please try, hope it can help you!
This comment was minimized by the moderator on the site
It's absolutely ridiculous that EXCEL requires the formula to be so complicated! All that should be needed is a SUBTOTAL(9,Range) WHERE/HAVING criteria (X,Y,Z).
This comment was minimized by the moderator on the site
Yes I agree, I am looking for the Excel formula so that the sum of the range (with criteria) is NOT affected by the Filtered columns.
This comment was minimized by the moderator on the site
I agree. It is ridiculous
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations