+ Reply to Thread
Results 1 to 6 of 6

Counting with Criteria

  1. #1
    Registered User
    Join Date
    05-12-2008
    Posts
    2

    Counting with Criteria

    I have googled and oogles, but with the multitude of counting methods and I haven't found the answer I need.

    I'm trying to count the number of case entries (rows) where there are if certain values that can occur in EITHER column. In my example, I want to know how many cases have either A>3 OR B>10... which would be a total of 4 cases. I can get to work for AND but not OR. Please help. Thanks.

    A B
    3 10
    3 0
    0 0
    0 10
    1 0
    0 10
    0 0
    2 5



    Here's a link to what I'm trying to explain:
    http://img227.imageshack.us/img227/1...lsamplett7.jpg
    Last edited by JCM96; 05-12-2008 at 03:50 AM.

  2. #2
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544
    Try this :

    =SUMPRODUCT((B2:B9>=3)*1)+SUMPRODUCT((C2:C9>=10)*1)-SUMPRODUCT((B2:B9>=3)*(C2:C9>=10)*1)

    Erik
    Just keep it simple !


    http://www.excelguide.eu
    In English as well as in Dutch

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by JCM96
    I have googled and oogles, but with the multitude of counting methods and I haven't found the answer I need.

    I'm trying to count the number of case entries (rows) where there are if certain values that can occur in EITHER column. In my example, I want to know how many cases have either A>3 OR B>10... which would be a total of 4 cases. I can get to work for AND but not OR. Please help. Thanks.

    A B
    3 10
    3 0
    0 0
    0 10
    1 0
    0 10
    0 0
    2 5



    Here's a link to what I'm trying to explain:
    http://img227.imageshack.us/img227/1...lsamplett7.jpg
    Try:

    =SUMPRODUCT(--(((A2:A9>=3)+(B2:B9>=10))>=1))
    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
    02-16-2006
    Posts
    49
    Sorry, I just have to ask...
    in the last solution entry
    =SUMPRODUCT(--(((A2:A9>=3)+(B2:B9>=10))>=1))

    what does the -- right after SUMPRODUCT do?

    THANKS!

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by pdgood
    Sorry, I just have to ask...
    in the last solution entry
    =SUMPRODUCT(--(((A2:A9>=3)+(B2:B9>=10))>=1))

    what does the -- right after SUMPRODUCT do?

    THANKS!

    it converts arrays of TRUES/FALSES to 1's/0's so that Sumproduct() can do the math necessary to count.

  6. #6
    Registered User
    Join Date
    05-12-2008
    Posts
    2
    You guys are awesome! Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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