+ Reply to Thread
Results 1 to 7 of 7

COUNTIF with two criteria?

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    Kansas City, KS
    MS-Off Ver
    Excel 2007
    Posts
    2

    COUNTIF with two criteria?

    Need help...

    I need to return the number of occurrences in which two criteria are met:

    Instances in which A1:A2793 read "A1" AND in which the numerical value in C1:C2793 is >50.

    Any ideas?

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: COUNTIF with two criteria?

    If using XL2007 as implied in profile see COUNTIFS function

    =COUNTIFS(A1:A2793,"A1",C1:C2793,">50")

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: COUNTIF with two criteria?

    Instances in which A1:A2793 read "A1" AND in which the numerical value in C1:C2793 is >50.
    By "read A1" do you mean cell A1? (I'm being too literal probably, but you don't mean the text "A1"?)

    =SUMPRODUCT(($A$1:$A$2793=$A$1)*((COUNTIF(C1:C2793,">50")/(COUNTIF(C1:C2793,">50")))))

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: COUNTIF with two criteria?

    Palmetto, I don't quite follow the SUMPRODUCT, shouldn't it be (A1 issue excepted)

    Please Login or Register  to view this content.
    or if preferred using double unary

    Please Login or Register  to view this content.
    again though just to reiterate if indeed you are running XL07 and backwards compatibility is not an issue then use COUNTIFS in preference to SUMPRODUCT.

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: COUNTIF with two criteria?

    DO,

    I'm getting the correct result with my formula.

    Both of the formulas you gave return a result that is off (less) by one. Don't know the reason for this, though.
    Last edited by Palmetto; 08-28-2009 at 06:37 PM. Reason: removed attachment - incorrect formula results

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: COUNTIF with two criteria?

    The correct answer is 9, there are ten instances of Bob in A the first of which has a value of 50 assigned to it - ie should be excluded.

  7. #7
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: COUNTIF with two criteria?

    Yeah, caught me not paying attention again! ">50" means just that. (at myself).

+ 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