+ Reply to Thread
Results 1 to 14 of 14

Counting cells - changing criteria

  1. #1
    Registered User
    Join Date
    08-08-2014
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    7

    Counting cells - changing criteria

    Happy new year everyone

    I am trying to figure out how to formulate a countif or similar function that would count the number of cells which would work with changing criteria and accomplish the following scenario.

    As you see in the attached image the left column contains the variables and the right column contains the instances each variable occurs individually.

    The range is always constant
    Though the criteria is ever changing the variables are always numeric and descending (although the example shows the variables ascending)

    Any feedback would be much appreciated.
    Attached Images Attached Images

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Counting cells - changing criteria

    attach sample excel file instead of image
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Registered User
    Join Date
    08-08-2014
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    7

    Re: Counting cells - changing criteria

    I created and attached a sample workbook per request.
    Attached Files Attached Files

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting cells - changing criteria

    what are you counting exactly
    are those the results in column e?
    where do you want the formula?
    i can see there 3 1005 and 5 1005
    Last edited by martindwilson; 01-03-2015 at 02:24 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    08-08-2014
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    7

    Re: Counting cells - changing criteria

    The attached image and workbook are independent from each other. As I had discarded the workbook associated with the sample image I created a new workbook which I attached to this thread. Therefore if you are checking the workbook you can ignore the original sample image. Also the attached workbook shows the numeric variable in descending order as intended.

    Referring to the attached workbook, cells e6 - e11 each show how many instances of each variable is present (for example e6 content is 3 because there are three instances of 1005)
    The preferred location of the formula would be in column e where it would populate the cells. The current content of e6-e11 can be replaced or ignored as it is just a representation of what I am trying to accomplish.

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Counting cells - changing criteria

    E6=IFERROR(INDEX(FREQUENCY(MATCH($C$6:$C$27,$C$6:$C$27,0),ROW(INDIRECT("1:"&COUNTA($C$6:$C$27)))),SMALL(INDEX((FREQUENCY(MATCH($C$6:$C$27,$C$6:$C$27,0),ROW(INDIRECT("1:"&COUNTA($C$6:$C$27))))=0)*10^10+ROW(INDIRECT("1:"&COUNTA($C$6:$C$27)+1)),0),ROWS($F$6:$F6))),"")
    Try this and copy towards down
    Attached Files Attached Files

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

    Re: Counting cells - changing criteria

    Hi. Try this...
    Attached Files Attached Files
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting cells - changing criteria

    a tad more simple no helper columns and a lot shorter!
    to get results as shown in e6:e11
    e6 =COUNTIF($C$6:$C$200,C6)
    e7 =COUNTIF($C$6:$C$200,LARGE($C$6:$C$200,SUM($E$6:E6)+1))
    fill down e7
    Last edited by martindwilson; 01-03-2015 at 03:42 PM.

  9. #9
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: Counting cells - changing criteria

    Here is my way to do it..(Non Arrayed)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Check the attached file:-
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting cells - changing criteria

    is this a longest formula competion?

  11. #11
    Registered User
    Join Date
    08-08-2014
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    7

    Re: Counting cells - changing criteria

    Thanks everyone for their contribution. I just accessed the forum and saw multiple feedbacks. I'll be going through each response trying to analyze the formulas to see which one would adapt best to my needs. Meanwhile I wanted to express my appreciation again.

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

    Re: Counting cells - changing criteria

    I've just been looking at some of these replies. they all have their plus and minus points (setting aside length). One lists the number beside the count, the rest are clever enough not to need to do that. One big difference is how they handle gaps (where a number is missed out). Some solutions return a 0 (but seems to duplicate the last row) whereas others skip the missing number entirely....

    Isn't Excel addictive...
    Attached Files Attached Files

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting cells - changing criteria

    just change my second formula to
    =IFERROR(1/(1/COUNTIF($C$6:$C$200,LARGE($C$6:$C$200,SUM($F$6:F6)+1))),"") will eliminate 0

  14. #14
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Counting cells - changing criteria

    hmmm why did i post this here ah its gone

+ 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: 06-13-2014, 07:08 PM
  2. Replies: 3
    Last Post: 03-01-2012, 06:17 AM
  3. Replies: 5
    Last Post: 12-31-2011, 06:10 AM
  4. Counting Cells with multiple criteria.One criteria supporting wild
    By Azhar Saleem in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 07:06 AM
  5. [SOLVED] Counting Cells with multiple criteria.One criteria supporting wild
    By Azhar Arain in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 05:06 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