Search code examples
excelexcel-formulaexcel-2010excel-2007

Better formula for multiple sumproducts


I have the following data in range "A1:E3"

1   2   12  25  30
3   13  23  28  31
5   14  17  18  35

I need to find out how many numbers falls in the range of 1 to 10 in each row. Eg. In Row 1, there are 2 numbers in the range of 1 to 10, in Row 2, there is only 1 and in Row 3, there is 1 so the total is 2+1+1=4. Similarly, I need to find how many numbers falls in the range of 11 to 20, 21 to 30 and 31 to 40 for each row. I wrote a sumproduct formula and added it twice by changing the range.

1   to  10  4
11  to  20  5
21  to  30  4
31  to  40  2

I have the above date in Range G1:J4 where column J has the below formula which is pulled down 2 more rows.

=SUMPRODUCT((A$1:E$1>=G1)*(A$1:E$1<=I1))+SUMPRODUCT((A$2:E$2>=G1)*(A$2:E$2<=I1))+SUMPRODUCT((A$3:E$3>=G1)*(A$3:E$3<=I1))

When my rows increases, the formula grows bigger and bigger. Can anyone suggest a better formula for this?

Thanks


Solution

  • The frequency formula was built specifically for this type of problem. In my worksheet I highlighted the range "C8:C11" and I array entered this formula with CTRL + Shift + Enter:

    =FREQUENCY(A1:E3,B8:B11)
    

    enter image description here