excel透视表计数去重

It seemed simple enough, but counting the AutoFilters on an Excel sheet is a tough job! The answer to "How many worksheet AutoFilters are there?" is "It depends!"

看起来很简单,但是在Excel工作表上计算自动过滤器是一项艰巨的任务! 答案是“有多少个工作表自动筛选器?” 是“取决于!”

You can read the fascinating (to me!) results below.

您可以在下面阅读引人入胜的(对我来说!)结果。

过去的好时光 (The Good Old Days)

In the old days, before Excel 2003, you could only have one AutoFilter on a sheet. That's pretty easy to count – either 1 or 0.

过去,在Excel 2003之前,工作表上只能有一个自动筛选。 这很容易计算-1或0。

For example, this Excel 2010 sheet has a single list that is not a named table. An AutoFilter was applied to this list, and the AutoFilter arrows have been turned off.

例如,此Excel 2010工作表具有一个不是命名表的列表 。 AutoFilter已应用于此列表,并且AutoFilter箭头已关闭 。

If you point to one of the headings, where the hidden arrow is, the tooltip for that filter appears, so that shows us the AutoFilter is still active.

如果您指向其中一个隐藏箭头所在的标题,则会显示该过滤器的工具提示,从而向我们显示自动过滤器仍处于活动状态。

计算工作表自动筛选器 (Count the Worksheet AutoFilters)

To count the worksheet AutoFilters, I usually use AutoFilterMode to check if one exists. Recently, Pascal (forum name: p45cal) emailed me, to suggest that checking for a worksheet AutoFilter would be more reliable. Thanks, Pascal, for inspiring this test!

要计算工作表自动过滤器,我通常使用AutoFilterMode来检查是否存在。 最近,Pascal(论坛名称:p45cal)通过电子邮件发送给我,建议检查工作表“自动筛选”会更可靠。 感谢Pascal,启发了这项测试!

This code tests for a worksheet AutoFilter, by using either AutoFilterMode or AutoFilter:

此代码通过使用AutoFilterMode或AutoFilter测试工作表AutoFilter:

Sub CountSheetAutoFilters()
Dim iARM As Long
Dim iAR As Long
'counts all worksheet autofilters
'even if all arrows are hidden
If ActiveSheet.AutoFilterMode = True Then iARM = 1
Debug.Print "AutoFilterMode: " & iARM
If Not ActiveSheet.AutoFilter Is Nothing Then iAR = 1
Debug.Print "AutoFilter: " & iAR
End Sub

When I test that code in the Immediate window, both counting methods show 1 AutoFilter.

当我在立即窗口中测试该代码时,两种计数方法均显示1自动筛选。

工作表上的命名表 (Named Table on the Worksheet)

What happens if there is a named table on the worksheet, and it has its own AutoFilter? I ran the code again, on the worksheet shown below. It has a named table, and it has an AutoFilter applied, with all the arrows hidden.

如果工作表上有一个命名表,并且它具有自己的自动筛选器,会发生什么? 我在下面显示的工作表上再次运行了代码。 它有一个命名表,并应用了“自动筛选”,所有箭头都隐藏了。

When I test the code in the Immediate window, both counting methods show zero AutoFilters. I consider that count correct, because there is a ListObject with an AutoFilter, but no worksheet AutoFilter.

当我在立即窗口中测试代码时,两种计数方法均显示零个自动过滤器。 我认为该计数是正确的,因为有一个带有AutoFilter的ListObject,但是没有工作表AutoFilter。

In the screen shot above, you can see that cell A1 is selected – outside of the named table. When I selected cell B1, inside the table, and ran the code, the results were different. AutoFilterMode was still zero, but AutoFilter detected one.

在上面的屏幕截图中,您可以看到已选择单元格A1 –在命名表之外。 当我在表中选择单元格B1并运行代码时,结果是不同的。 AutoFilterMode仍为零,但AutoFilter检测到一个。

Apparently, Excel is counting the active cell's table as a worksheet AutoFilter, with the AutoFilter counting method. I'd rather go with the AutoFilterMode's zero, and count the ListObject AutoFilters separately.

显然,Excel使用自动筛选计数方法将活动单元格的表格作为工作表自动筛选进行计数。 我宁愿使用AutoFilterMode的零,并分别计算ListObject自动过滤器。

使用可见的自动过滤器箭头进行测试 (Test With Visible AutoFilter Arrows)

Maybe the hidden arrows are affecting the results. To check, I ran code to show all the list AutoFilter arrows, and tested again.

也许隐藏的箭头正在影响结果。 为了进行检查,我运行了代码以显示所有列表AutoFilter箭头 ,然后再次进行了测试。

The results were the same as in the previous tests, so visible arrows don't make a difference.

结果与之前的测试相同,因此可见箭头没有区别。

工作表上的多个表 (Multiple Tables on Worksheet)

For some final tests, I created a sheet with 3 lists:

对于一些最终测试,我创建了一个包含3个列表的工作表:

  1. Named Table – no AutoFilter – no arrows命名表–无自动筛选–无箭头
  2. Named Table – AutoFilter – visible arrows命名表–自动筛选–可见箭头
  3. Worksheet table – AutoFilter – visible arrows工作表表–自动筛选–可见箭头

With a cell in Named Table 1 selected, AutoFilterMode counted one, and AutoFilter counted zero. As in the previous test, the AutoFilter counting method is based on the active cell's table AutoFilter. It doesn't detect the AutoFilter in Worksheet Table 3.

在命名表1中选择一个单元格时,AutoFilterMode计数为1,而AutoFilter计数为零。 与之前的测试一样,自动筛选的计数方法基于活动单元格的表自动筛选。 它不会在工作表表3中检测到自动筛选。

With any other cell in the worksheet selected, the results were different – both AutoFilter and AutoFilterMode counted one – the correct count of worksheet AutoFilters.

在选择工作表中的任何其他单元格时,结果是不同的– AutoFilter和AutoFilterMode都计算为一个–工作表AutoFilters的正确计数。

计算工作表自动筛选器结论 (Counting Worksheet AutoFilters Conclusion)

Because ActiveSheet.AutoFilter detects the AutoFilter in the active cell, it could cause a miscount of worksheet AutoFilters.

由于ActiveSheet.AutoFilter在活动单元格中检测到自动筛选,因此可能导致工作表自动筛选错误计数。

I'll stick to the AutoFilterMode for a count of worksheet AutoFilters, and use other code to count the ListObject AutoFilters.

我将坚持使用AutoFilterMode来计算工作表AutoFilters ,并使用其他代码来计算ListObject AutoFilters 。

其他Excel版本中的自动筛选 (AutoFilters in Other Excel Versions)

After running these tests in Excel 2010, I tested the AutoFilter counting code in Excel 2003, and got the same results.

在Excel 2010中运行这些测试之后,我在Excel 2003中测试了自动筛选计数代码,并获得了相同的结果。

If you find different results in other versions of Excel, please let me know.

如果您在其他版本的Excel中发现不同的结果,请告诉我。

翻译自: https://contexturesblog.com/archives/2012/05/31/trouble-counting-excel-autofilters-on-sheet/

excel透视表计数去重


http://www.taodudu.cc/news/show-3297522.html

相关文章:

  • excel透视表计数去重_Excel数据透视表中的唯一计数
  • Excel 透视图
  • java excel 透视_Java在Excel中创建透视表方法解析
  • python处理excel数据透视表_Python也能轻松做出Excel透视表的效果,一切技巧全在这里...
  • java excel 透视_Java Excel透视表相关操作实现代码
  • java excel 透视_java基于poi导出excel透视表代码实例
  • 2017年Android开源项目及库汇总
  • 前端知识体系1:【css/js/vue/es6/手写/安全/优化】
  • python小球在窗口弹来弹去_《Python游戏趣味编程》 第2章 弹跳的小球
  • 400倍加速,PolarDB HTAP 实时数据分析技术解密
  • R语言 数理统计
  • Python数据分析基础【建模篇】
  • 400倍加速, PolarDB HTAP实时数据分析技术解密
  • 使用爬虫爬取移动端数据
  • 70款常用的免费数据源分享(最新)
  • 校园网AP隔离情况下用户互通的几种方法总结
  • Adaptive AUTOSAR (AP) 平台设计(8)——诊断
  • AP Autosar平台设计 10 Persistency持久性/可靠性存储
  • 用友软件T3数据库表结构表名、数据字典
  • Adaptive AUTOSAR (AP) 平台设计(12)——UCM
  • 简单的统计教学方式——NCSS
  • AP Autosar平台设计 9 诊断
  • ap计算机科学a 5分,新鲜出炉2019年AP考试5分率分析,尝鲜版来啦~~
  • 《数据处理与知识发现》章节测验复习
  • Adaptive AUTOSAR (AP) 平台设计(9)——Persistency
  • ap计算机教材pdf百度云,AP计算机A:你需要知道的信息
  • Fragment 与 Viewpager 联合使用在网络上获取图片
  • jQuery数组处理
  • 诸子百家
  • jQuery数组处理完全详解

excel透视表计数去重_在工作表上对Excel自动筛选进行计数相关推荐

  1. 表 合并字段_多工作表动态合并,其实很简单

    小伙伴们好啊,今天老祝和大家分享一个动态合并多个工作表的技巧. 很多时候,咱们的数据是按照部门或是月份等项目,分别存放在不同工作表中的,要对这些数据进行分析汇总的时候,需要先将不同工作表中的数据合并到 ...

  2. 人名和成绩一起排序_不同工作表中的数据表排序各异,如何用Excel数据透视表汇总?...

    用数据透视表做分析的时候,有时源数据有好几张数据表,且分布在不同的地方.且因为维护源数据的人不同,数据表的行.列标题也未必固定不变. 那么问题来了,如果各个数据表的行标题排序各不相同,如何将它们合并到 ...

  3. excel中 复制工作表_如何在Excel 2013中轻松移动或复制工作表

    excel中 复制工作表 There may be times when you want to create a new Excel worksheet based on an existing w ...

  4. vb整合多个excel表格到一张_VB合并工作表下载

          VB合并工作表最新版是一款功能强大且界面简洁美观的excel表格合并工具,VB合并工作表最新版操作简便且易上手可以运行稳定,能够为大家解决合成打开卡顿等问题,实现多薄多表合并,VB合并工作 ...

  5. Excel如何将一张工作表拆分成多个工作表Sheet?

    工作中我们经常会遇到这种情况,所有的数据都整合在一个Excel表格里面了,现在想按需求分别拆分成多个工作表,有什么好办法吗?利用透视表,我们就可以轻松解决. 如下图所示,从销售一部到销售七部的所有业绩 ...

  6. 在EXCEL中一个窗口显示多个工作表

    在EXCEL中一个窗口显示多个工作表 目录 在EXCEL中一个窗口显示多个工作表 1.点击视图选项卡中"全部重排" 2.弹出窗口 在"排列方式"中选点击&quo ...

  7. 在Excel表格中,任意修改原工作表数据,新工作中内容跟着改变,如何操作?

    在Excel表格中,任意修改原工作表数据,新工作中内容跟着改变,如何操作? 目录 在Excel表格中,任意修改原工作表数据,新工作中内容跟着改变,如何操作? 1.例如将原成绩表中的表格,复制到新成绩表 ...

  8. 在excel UiPath中重命名或更改工作表名称

    在excel UiPath中重命名或更改工作表名称 很多时候我们使用excel来自动化业务流程. 我们通过 excel 获取自动化的输入数据,或者我们需要将 excel 作为输出发送给业务用户. 假设 ...

  9. 同时删除两张表的数据_把数据表中对应工作表的数据首先删除,然后导入数据...

    大家好,我们今日继续讲解VBA数据库解决方案的第28讲内容:利用VBA,把数据表中对应工作表的数据首先删除,然后向数据表中导入工作表数据.数据库的讲解已经持续一段时间了,从对简单数据库的认识到利用VB ...

最新文章

  1. linux 和windows 下golang安装
  2. pptpd免radius限速、限连接+自由定制功能脚本
  3. Java源码解析:深入理解==和equals()
  4. ubuntu 13.04 mysql_Ubuntu13.04 下MySQL5.6安装过程
  5. vm ubuntu设置中文_如何在本地Ubuntu Linux机器或VM上设置LAMP服务器
  6. JQuery 各节点获取函数:父节点,子节点,兄弟节点
  7. OPNsense用户手册-基于虚拟机和云的安装
  8. Verilog基本语法之wire和reg
  9. 浅谈prometheus(普罗米修斯) client golang
  10. 新媒体运营胡耀文教程:产品运营视阈下的数据分析
  11. 点击a标签弹出iframe_iframe标签与a标签
  12. Android实现语音发送播放功能以及示例代码
  13. [CSP-S 2022] 策略游戏
  14. KaTex 数学公式 基础
  15. python3.6安装scrapy出错_python3.6安装scrapy
  16. reactos 编译,安装篇
  17. u盘第一扇区 分区表_备份U盘分区表,未雨绸缪
  18. Matlab 如何输入矩阵
  19. Win7系统下解决魔兽争霸全屏问题
  20. vue绑定失效的问题(操纵组件不更新)

热门文章

  1. 爱奇艺VIP涨价幅度高达50%,光靠涨价就能改革商业模式?
  2. 如何使用掘金进行量化策略效析
  3. 史上最简单的Spring Security教程(八):用户登出成功LogoutSuccessHandler高级用法
  4. 选择physx处理器 gpu 计算 matlab 计算_边缘计算服务器,迎接边缘计算
  5. Google Earth Engine(GEE)批量下载代码(以 NDVI数据为例)
  6. 陶瓷电容—导致失效的七大原因解析
  7. 数值计算 - 常用函数值计算方法
  8. 迈克尔逊干涉仪仿真程序_如何使用迈克尔逊编程语言在Tezos上编写智能合约
  9. 2019小升初择校之昆山娃
  10. js汉字排序问题--支持中英文混排,兼容各浏览器,包括CHROME