+ Reply to Thread
Results 1 to 8 of 8

How to count the number of cell in row if the cell meet criteria

  1. #1
    Registered User
    Join Date
    11-26-2020
    Location
    HK
    MS-Off Ver
    office365
    Posts
    1

    Exclamation How to count the number of cell in row if the cell meet criteria

    Hi everyone, I cannot deal with the problem as follows:

    If I want to count how many cells in row if it meets "Orange" with excel statement, how can i do it?

    For example: Orange is 4, Kiwifruit is 2 etc...


    A B C D E
    ------------------------------------
    Apple a a a a
    Orange b b b b
    Lemon e e e e
    Kiwifruit y y

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: How to count the number of cell in row if the cell meet criteria

    perhaps

    =COUNTIF(INDEX(B:E,MATCH("Orange",A:A,0),0),"?*")

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to count the number of cell in row if the cell meet criteria

    Here is another option...
    =SUMPRODUCT(--(A1:A5="orange")*(B1:F5<>""))
    (I increased the range for testing)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to count the number of cell in row if the cell meet criteria

    On checking, it seems the COUNTIF/Index doesnt work on an expanded range (maybe Im missing something?)
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Apple a a a a Sumproduct Countif
    2
    Orange b b b b b
    7
    5
    3
    Lemon e e e e
    4
    Kiwifruit y y
    5
    Orange b b

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

    Re: How to count the number of cell in row if the cell meet criteria

    Quote Originally Posted by FDibbins View Post
    On checking, it seems the COUNTIF/Index doesnt work on an expanded range (maybe Im missing something?)
    Sure, COUNTIF(INDEX(MATCH returns only first single row if matched.
    Quang PT

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to count the number of cell in row if the cell meet criteria

    oops of course, thanks (late nite, brain not working). So, if "orange" is repeated further down, it will be ignored.

  7. #7
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: How to count the number of cell in row if the cell meet criteria

    correct; of course, per OP post, there's nothing to actually indicate that's the case... ;-)

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to count the number of cell in row if the cell meet criteria

    Quote Originally Posted by XLent View Post
    correct; of course, per OP post, there's nothing to actually indicate that's the case... ;-)
    You make a valid point

+ 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. [SOLVED] Formula to count number of occurrences that meet multiple criteria
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-13-2018, 07:38 AM
  2. [SOLVED] Count cells in range that match corresponding cell, and meet an additional criteria.
    By Nyima in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2016, 04:11 PM
  3. [SOLVED] Count cell that meet a criteria and are not blank
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-16-2014, 05:56 PM
  4. How to count the number of rows that meet multiple selection criteria
    By mcnallyb in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-21-2014, 11:26 AM
  5. [SOLVED] Formula to use to count the number of cells in a column which meet three sets of criteria
    By Dhabitude in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-11-2013, 11:22 AM
  6. [SOLVED] Trying to count the number of cells that meet two sets of Criteria
    By Pablo12 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-24-2013, 12:02 PM
  7. [SOLVED] How do I count nonblank cells that meet criteria in another cell?
    By jimswinder in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-20-2006, 11:45 AM

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