+ Reply to Thread
Results 1 to 8 of 8

Count a number of values if certain criteria in another column is met

  1. #1
    Registered User
    Join Date
    08-04-2020
    Location
    Manchester
    MS-Off Ver
    Excel for Mac 16.39
    Posts
    24

    Count a number of values if certain criteria in another column is met

    Hi all,

    I would rally appreciate some help before I lose my mind!! I have tried to get my head around the SUM, SUMIF, COUNTIF and LOOKUP options, and every variation of the same to achieve an outcome, but I have failed.

    I have a contractual document set out in excel. Columns run as follows; Clause number, Clause M or blank, then clause is either C, NC or U. I want to be able to the following;

    - count the number of clauses
    - count the number of M's (and therefore the number of blanks)
    - of the number of Ms, how many are C, NC or U's.
    - then if I update a clause from a C to an NC, I was the above count to update also.

    Thank you so much in advance of any help you can provide.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count a number of values if certain criteria in another column is met

    it sounds like you need a COUNTIFS but without seeing the actual data or a reasonable representation thereof it is difficult to give you much more. See the yellow banner above to upload a sample workbook.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    08-04-2020
    Location
    Manchester
    MS-Off Ver
    Excel for Mac 16.39
    Posts
    24

    Re: Count a number of values if certain criteria in another column is met

    Thanks Sam...sample file attached.

    In the example, to try and reiterate, certain clauses are mandatory, and therefore are marked with an M in column D. You will also see that in column G, there is an option for the clause to be either C, NC, PC, U or R.

    I need to be able to;

    - count the number of clauses in column C (each cell with text would represent a clause)
    - count the number of mandatory clauses (indicated as mandatory with an M in column D)
    - of these mandatory clauses, how many are then C, NC, PC, U or R. (And then the same for the non-mandatory ones).
    - Then I would like these numbers to update automatically as the clauses change from NC or C for example.

    I hope this makes sense...and I appreciate you taking to the time respond and help.
    Attached Files Attached Files

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count a number of values if certain criteria in another column is met

    so, those text in blue (cells C4, C5 and C7 with prelminary, definitions and interpretation) are they also to be counted since they are "text" in column C?
    and this...
    of these mandatory clauses, how many are then C, NC, PC, U or R. (And then the same for the non-mandatory ones).
    do you mean individually such as a count of all Cs and a count of all NCs etc. OR do you mean a combined count of all? so if there are (for example) 3 Cs the count would be 3 OR if there are 3 Cs and 2 NCs and 1 R the count would be 6?
    And non mandatory ones would be as an example rows 11, 12 and 14 (and more)?

  5. #5
    Registered User
    Join Date
    08-04-2020
    Location
    Manchester
    MS-Off Ver
    Excel for Mac 16.39
    Posts
    24

    Re: Count a number of values if certain criteria in another column is met

    Ideally, the text in blue would not be counted, as they are headings of sections of the document. If they can be excluded from the count that would be awesome!

    And then yes, an individual count of all M's which are C's...all M's which are NC's etc.

    Any blank row (not got an M in column D), is non-mandatory and another count as above is needed.

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count a number of values if certain criteria in another column is met

    this is what I have from my questions and your answers... (for all answers adjust the ranges to suit)
    for count of M in col D, =COUNTIF(D3:D19,"M")
    for clauses w/o M in col D =COUNTIFS(G3:G19,"<>"&"T",D3:D19,"")
    for count of M which are also C =COUNTIFS(G3:G19,"C",D3:D19,"M")
    I'm not going to give you each of the others (the NC, PC, U or R) as you can simply adjust the above one to count those.
    I'm assuming that all those in col C you don't want counted will also have a T in col G so that is how I'm differentiating them and excluding them.
    and if for some reason you want to do counts of multiples, this...
    =SUM(COUNTIFS(G3:G19,"<>&T",G3:G19,{"C","PC","R","U","NC"},D3:D19,"M"))

  7. #7
    Registered User
    Join Date
    08-04-2020
    Location
    Manchester
    MS-Off Ver
    Excel for Mac 16.39
    Posts
    24

    Re: Count a number of values if certain criteria in another column is met

    Awesome...works like a charm...thank you so much!

    I have incorporated things into the master document and it is soooo good. Excel never ceases to amaze me...but here is one for you...

    Is there anyway of taking a whole row, and populating a new worksheet/table with that row based on certain criteria. For example, using the file I have uploaded above;

    - If in column A, I listed each clause with its owner; "Finance", "Commercial", "Legal", "Mandatory"
    - Then if one of those clauses was marked as "NC", the whole row would copy across and populate a new table in the relevant worksheet for the owner.

    If this was possible, Finance would only have to look at one worksheet and see what was NC for them etc...

    Or am I asking too much??

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Count a number of values if certain criteria in another column is met

    That is likely doable, but it would be better if...
    a) you worked up a new workbook WITH examples AND expected results (you only need a few examples) and
    b) you might want to think about starting a new post. You can link to this post if you believe this post info will help.

    There likely would be formulas that could do that but I believe they might be awkward depending on what is needed however VBA might be the way to accomplish it more effectively which is a different set of excel skills (which I don't possess).
    So starting a new post, if VBA is the route to go a moderator might move the post to that forum.

+ 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: 5
    Last Post: 06-30-2021, 06:44 AM
  2. Replies: 7
    Last Post: 04-07-2021, 06:04 PM
  3. Replies: 3
    Last Post: 10-05-2020, 06:29 AM
  4. [SOLVED] How to count number values in LEFT & RIGHT in a cell range with criteria
    By Rev12 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-12-2020, 01:03 AM
  5. Replies: 3
    Last Post: 08-24-2017, 05:59 AM
  6. Replies: 4
    Last Post: 11-01-2016, 03:28 PM
  7. [SOLVED] Count Unique Values in Column A that meet criteria in Column B
    By ashakespeare in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-04-2012, 07:33 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