+ Reply to Thread
Results 1 to 13 of 13

Countif with multiple criteria

  1. #1
    Registered User
    Join Date
    03-17-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    3

    Countif with multiple criteria

    HI, I have a problem.

    I would like to count number of time X gets more than 0 for Test 1 or Test 2.
    Therefore, as long as he gets more than 0 for 1 of the test (T1 or T2), i want to count. Results should give me 3 in this case.


    A | T1 |T2
    X | 21 | 00
    X | 00 | 23
    X | 00 | 00
    Y | 00 | 45
    Y | 34 | 00
    X | 21 |55

    Thanks!
    Last edited by heartfeltyeo; 03-17-2016 at 10:13 PM.

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Countif with multiple criteria

    What is passing? What is C? Is that the column?
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  3. #3
    Registered User
    Join Date
    03-17-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    3

    Re: Countif with multiple criteria

    HI, edited my post! made some mistake in the writing.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: Countif with multiple criteria

    Assuming A2:A7 is X or Y
    B2:B7, C2:C7 is value
    I wonder if B2:C7 was value or text-stored-as number or not, but try:

    =COUNTIFS(A2:A7,"X",--B2:B7,">0")
    Quang PT

  5. #5
    Registered User
    Join Date
    03-17-2016
    Location
    Singapore
    MS-Off Ver
    2010
    Posts
    3

    Re: Countif with multiple criteria

    Hello, the formulae gave me error.

    Yes B2: C7 Is number.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: Countif with multiple criteria

    Quote Originally Posted by heartfeltyeo View Post
    Hello, the formulae gave me error.

    Yes B2: C7 Is number.
    What kind of error did you get?
    Or try to remove"--"?

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,963

    Re: Countif with multiple criteria

    Please Login or Register  to view this content.
    Ben Van Johnson

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,179

    Re: Countif with multiple criteria

    Try this...
    =SUMPRODUCT(--((A2:A7="X")*((B2:B7>0)+(C2:C7>0))>0))

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Countif with multiple criteria

    Quote Originally Posted by bebo021999 View Post
    =COUNTIFS(A2:A7,"X",--B2:B7,">0")
    COUNTIFS won't accept that syntax --B2:B7.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,179

    Re: Countif with multiple criteria

    Or try... =SUMPRODUCT((A2:A7="X")*(B2:B7+C2:C7>0))

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Countif with multiple criteria

    When your example is converted to excel values on a worksheet, spaces are introduced if not careful so that may account for errors. Here are two methods of counting for you. I have entered X and Y in F2 and F3 and used those cells as references in the formulae.
    Enter in G2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    OR
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A
    B
    C
    D
    E
    F
    G
    1
    A
    T1
    T2
    2
    X
    21
    0
    X
    4
    3
    X
    0
    23
    y
    2
    4
    X
    0
    0
    5
    Y
    0
    45
    6
    Y
    34
    0
    7
    X
    21
    55
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Countif with multiple criteria

    Here's yet another one...

    =SUMPRODUCT(--(A2:A7="X"),--(MMULT(--(B2:C7>0),{1;1})>0))

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Countif with multiple criteria

    One more for good measure...

    =SUMPRODUCT(--(A2:A7="X"),SIGN((B2:B7>0)+(C2:C7>0)))

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. countif multiple criteria
    By 13lack13lade in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2013, 06:16 AM
  2. Countif, Multiple Criteria, Multiple Sheets, Excel 2003
    By shyammankoo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-07-2013, 06:50 AM
  3. [SOLVED] trying to do a "countif" with multiple ranges and multiple criteria. Countif, Sumproduct?
    By completelyhis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2013, 06:12 PM
  4. [SOLVED] COUNTIF multiple criteria
    By Ryusui in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2012, 06:31 PM
  5. COUNTIF multiple criteria
    By dschwister in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-09-2011, 07:57 PM
  6. Trying to COUNTIF when multiple criteria are met on multiple column data set
    By TGCRequiem in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-15-2011, 12:58 AM
  7. [SOLVED] Countif w/ Multiple Criteria-How do I use countif
    By Patrick_KC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-09-2005, 05:05 PM
  8. [SOLVED] COUNTIF Multiple Criteria
    By Lori Hornick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2005, 01:06 PM

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