Home > Software design >  Range filtering on excel and count rows
Range filtering on excel and count rows

Time:11-24

I need your help about an excel range filtering, it's about a school project. 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.

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.

Many thanks!

CodePudding user response:

With Office 365 we can do this in one formula and the results will spill:

=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.

enter image description here

With LET we can move the variables to the front:

=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))))

CodePudding user response:

No VBA needed:

If your values are in column A, just enter 0 and 9999 like in columns D/E. The rest of the numbers can be done with =D2 1000 and =E2 1000 and pulled down until 350k.

The counting can be done with =COUNTIFS(A:A,">="&D:D,A:A,"<="&E:E) in column F and pulled down.

enter image description here

  • Related