+ Reply to Thread
Results 1 to 6 of 6

Problem with IF statement within a COUNTIF statement

  1. #1
    Registered User
    Join Date
    07-08-2008
    Location
    Durham, NC
    Posts
    10

    Problem with IF statement within a COUNTIF statement

    Hello,

    I am trying to have a cell in sheet "Summary" count the number of cells in column DX of sheet "Analyses" that are greater than 0, provided that the value in column A of "Analyses" corresponds with the value in B8 of sheet "Summary."

    (In "Analyses," there are 106 subjects, each taking up 64 rows. So, columns 1-64 correspond to Subject 1, columns 65-128 correspond to subject 2, etc. In column DX, each subject has 64 values that are either 0 or greater than 0. In "Summary," each subject has one row that summarizes the 64 trials. I want a single cell in the "Summary," sheet to reflect the number of times each subject produces a value greater than 0 in column DX of "Analyses.")

    I tried using this formula, but it did not work correctly:

    =COUNTIF(IF(Analyses!$A$1:$A$10000=Summary!B8,Analyses!$DX$1:$DX$10000,""),">0")

    (Summary!B8 = 1, so I am trying to calculate the number of values in DX that are greater than 0 only for subject 1.)

    When I press enter, this yields a value of 384. This is impossible, given that subject 1 only has 64 possibilities of yielding a value greater than 0. Subject 1 has 2 values in column DX that are greater than 0.

    I tried making this an array formula by pressing Shift+Ctrl+Enter, and that just gives me a #VALUE! error.

    What am I doing wrong?

    Thanks in advance!
    Last edited by girlofscience; 04-22-2009 at 10:20 AM.

  2. #2
    Forum Contributor
    Join Date
    04-16-2009
    Location
    Stellenbosch, South Africa
    MS-Off Ver
    Excel 2003; Excel 2007; Excel 2010; Excel 2013
    Posts
    136

    Re: Problem with IF statement within a COUNTIF statement

    Hello

    Try;

    =SUMPRODUCT(--(Analyses!$DX$1:$DX$10000>0),--(Analyses!$A$1:$A$10000=B8))
    Regards

    Jon (Excel 2003, 2007, 2010, 2013)

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Problem with IF statement within a COUNTIF statement

    Perhaps

    =SUMPRODUCT(--(Analyses!$A$1:$A$10000=B8),--(Analyses!$DX$1:$DX$10000>0))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    07-08-2008
    Location
    Durham, NC
    Posts
    10

    Re: Problem with IF statement within a COUNTIF statement

    Thank you!!!

    Problem solved.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Problem with IF statement within a COUNTIF statement

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  6. #6
    Registered User
    Join Date
    07-08-2008
    Location
    Durham, NC
    Posts
    10

    Re: Problem with IF statement within a COUNTIF statement

    Done. Greatly appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1