Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Excel 2007 count (https://www.askmehelpdesk.com/showthread.php?t=449235)

  • Feb 19, 2010, 09:25 PM
    speck283
    excel 2007 count
    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
  • Feb 19, 2010, 10:11 PM
    JBeaucaire

    I'm not a huge PivotTable user, but I know your problem can be solved simply with a SUMPRODUCT() formula.

    Code:

            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.

  • All times are GMT -7. The time now is 12:09 AM.