简体   繁体   English

excel 上的范围过滤和计数行

[英]Range filtering on excel and count rows

I need your help about an excel range filtering, it's about a school project.我需要你关于 excel 范围过滤的帮助,这是关于一个学校项目的。 I have an excel file with 20k rows and a column with number range from 0 to 350k and I need somehow to filter them every 1k (0-999,1000-1999 etc) and to count how many rows/records have every team.我有一个 excel 文件,它有 20k 行和一个数字范围从 0 到 350k 的列,我需要以某种方式每 1k 过滤一次(0-999,1000-1999 等)并计算每个团队有多少行/记录。

I am thinking about macros or VBA script but i don't even know the starting point, i hope someone can help me from where to start.我正在考虑宏或 VBA 脚本,但我什至不知道起点,我希望有人能帮助我从哪里开始。

Many thanks!非常感谢!

No VBA needed:不需要 VBA:

If your values are in column A, just enter 0 and 9999 like in columns D/E.如果您的值在 A 列中,只需像在 D/E 列中一样输入09999 The rest of the numbers can be done with =D2+1000 and =E2+1000 and pulled down until 350k.数字的rest可以用=D2+1000=E2+1000完成,拉低到350k。

The counting can be done with =COUNTIFS(A:A,">="&D:D,A:A,"<="&E:E) in column F and pulled down.可以使用 F 列中的=COUNTIFS(A:A,">="&D:D,A:A,"<="&E:E)进行计数并下拉。

在此处输入图像描述

With Office 365 we can do this in one formula and the results will spill:使用 Office 365,我们可以在一个公式中执行此操作,结果将溢出:

=CHOOSE({1,2,3},SEQUENCE(351,,0,1000),SEQUENCE(351,,999,1000),FREQUENCY(A:A,SEQUENCE(350,,999,1000)))

Frequency is designed to take the number and the array of buckets and return the count.频率旨在获取桶的数量和数组并返回计数。

在此处输入图像描述

With LET we can move the variables to the front:使用 LET 我们可以将变量移到前面:

=LET(
    rng,     A:A,
    nmbckts, 351,
    gp,      1000,
    CHOOSE({1,2,3},
         SEQUENCE(nmbckts,,0,gp),
         SEQUENCE(nmbckts,,gp-1,gp),
         FREQUENCY(rng,SEQUENCE(nmbckts-1,,gp-1,gp))))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM