Log in

View Full Version : Excel 2007 count


speck283
Feb 19, 2010, 09:25 PM
Below are the columns of my excel 2007 spreadsheet...

red blue yellow
1 2 3
3 1 5
2 5 4
1 2 4

I am trying to COUNT the number of times a specified values occur in 2 instances...

1. I am trying to count the number of times the number 2 occurs in the "blue" column as long as the value in the "red" column is number 1 - answer... 2 times

2. Then I am trying to calculate the number of times the value 3 occurs in the "yellow" column as long as the value in the "blue" column is 2 AND the value in the "red" column is 1 - answer... 1 time

I have been trying this in either a pivot table or formula but have not had any success - Does anyone know if this can be accomplished in excel 2007 and can give examples of the process? (My preference would be a pivot table as there would be thousands of values).

Thank you very much for any guidance/assistance you may provide me.
Steven

JBeaucaire
Feb 19, 2010, 10:11 PM
I'm not a huge PivotTable user, but I know your problem can be solved simply with a SUMPRODUCT() formula.


A B C D E F G H
1 red blue yellow RedVal BlueVal Yellow Count
2 1 2 3 1 2 3 1
3 3 1 5
4 2 5 4
5 1 2 4


The formula in H2 would be:
=SUMPRODUCT(($A$2:$A$5=E2) * ($B$2:$B$5=F2) * ($C$2:$C$5=G2))

When you expand the formula for the depth of data, only expand it as far as needed. Resist the urge to use tons more rows or even the whole column.