+ Reply to Thread
Results 1 to 10 of 10

Count the number of cases that match the criteria

  1. #1
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Count the number of cases that match the criteria

    Hello everyone,

    The formula works perfectly: =COUNT(MATCH(D1:D6,A1:A26,0)), with array applied Ctrl+Shift+Enter.

    But the formula =COUNT(INDEX(B1:B26,MATCH(D1:D6,A1:A26,0))) does not work. Is it because the INDEX function does not support array?

    I got the example here. Thanks for helping me.
    Attached Files Attached Files

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

    Re: Count the number of cases that match the criteria

    Try this ...

    =COUNT(INDEX(MATCH(D1:D6,A1:A26,0),0))

  3. #3
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: Count the number of cases that match the criteria

    I need to count the column B please.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Count the number of cases that match the criteria

    Try this:

    =SUMPRODUCT((A1:A26={"A","AA","G","M","O","Z"})*B1:B26)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: Count the number of cases that match the criteria

    Hi, I really need to specify them as range which contains thousands of cells in the range. So I cannot specify them in advance.

    Is there a formula that can specify the range?

  6. #6
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: Count the number of cases that match the criteria

    If this is not possible, maybe a UDF needs to be created

    I don't know. I feel a normal Excel formula should do.

  7. #7
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019, Microsoft 365.
    Posts
    440

    Re: Count the number of cases that match the criteria

    I got the formula working now:

    =SUM(IF(ISERROR(MATCH(A1:A26,D1:D6,0)),"",B1:B26)), with array applied Ctrl+Shift+Enter.

  8. #8
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Count the number of cases that match the criteria

    Hello Bill,

    You can use SUMIF with just ENTER

    =SUMPRODUCT(SUMIF(A:A,D1:D6,B:B))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

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

    Re: Count the number of cases that match the criteria

    Quote Originally Posted by billj View Post
    I need to count the column B please.
    Sorry, try:

    =SUMPRODUCT(B1:B26*COUNTIF(D1:D6,A1:A26))

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Count the number of cases that match the criteria

    If the values in B can be other than 1, and it is a COUNT rather than a SUM you can also use this array:

    =COUNT(IF($B$1:$B$26>0,IF(ISERROR(MATCH($A$1:$A$26,$D$1:$D$6,0)),"",$B$1:$B$26)))

+ 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. Replies: 4
    Last Post: 11-01-2016, 03:28 PM
  2. Replies: 24
    Last Post: 10-28-2016, 12:22 PM
  3. Formula to count the number of cases that are open in a month
    By eekbubble in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2015, 10:09 AM
  4. [SOLVED] How do you count the number of dates that match a criteria
    By john dalton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-01-2014, 09:23 AM
  5. Replies: 1
    Last Post: 11-20-2014, 06:21 AM
  6. [SOLVED] Count the number of instances where multiple criteria match
    By kurt.l in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-10-2012, 12:12 PM
  7. Replies: 5
    Last Post: 09-22-2009, 06:11 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