+ Reply to Thread
Results 1 to 17 of 17

COUNTIFs: Multiple Cynamic Criteria

  1. #1
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    COUNTIFs: Multiple Cynamic Criteria

    I am struggling with a COUNTIF formula. I previously achieved success but now I want to add the option of choosing criteria so it is dynamic. Best explained, I need to be able to Count the number of times: "CEO-CFO"; "President"; "Manager" appear in each question (5 separate questions - so 5 different counts). But then I also want the count to change based on the criteria chosen. I will choose from a drop down menu the criteria, the criteria is coming from different columns in a table in another worksheet or I simply can choose All and I want the total count.

    On the Calculation tab: In E2:E11 is the criteria to be chosen. B17:D21 is where I am trying to complete the COUNT.
    Data: CRITERIA LOOK-UP for 'Calculation'!E2:E11 is in the tab 'Data'!C; 'Data'!S; 'Data'!D; 'Data'!H; 'Data'!C;'Data'!R;'Data'!T and Questions for the COUNT in Columns J:N


    I have tried several things: COUNTIFs; SUM IFS and I cannot get anything to work.

    File is attached

    Any help is greatly appreciated!

  2. #2
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    No file. please have another go...
    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

  3. #3
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,421

    Re: COUNTIFs: Multiple Cynamic Criteria

    Welcome to the forum.

    Your file is not yet attached. Let us know if you are having problems.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    I was able to attach file (finally) but I had to change a lot due to size of file.

    On the Calculation tab: In E2:E5 is the criteria to be chosen. B10:D12 is where I am trying to complete the COUNT.
    Data: CRITERIA LOOK-UP for 'Calculation'!E2:E7 is in the tab 'Data'!B; 'Data'!H; 'Data'!J and Questions for the COUNT in Columns D:F
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    UPDATE: I have a formula that is working BUT...I have too many scenarios for Excel to accept. How do I shorten the formula so I can get all possible outcomes to COUNTIFs...I am only showing 3 different criteria with each having 2 options but my real data set will have 5 criteria with each having 2 options. So close but just need to get over this o. =IF(AND(E5="Yes",E6="Yes"),COUNTIFS(DATA!D:D,CALCULATION!B10,DATA!J:J,CALCULATION!E7),IF(AND(CALCULATION!E5="Yes",CALCULATION!E6="Yes"),COUNTIFS(DATA!D:D,CALCULATION!B10,DATA!H:H,CALCULATION!E4),""))ne hurdle. New file attached
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    What's the difference between these:
    =IF(AND(E5="Yes",E6="Yes"),
    COUNTIFS(DATA!D:D,CALCULATION!B10,DATA!J:J,CALCULATION!E7),

    IF(AND(CALCULATION!E5="Yes",CALCULATION!E6="Yes"),
    COUNTIFS(DATA!D:D,CALCULATION!B10,DATA!H:H,CALCULATION!E4),""))


    they are both Yes/Yes responses. Do you mean E4 at the end????

  8. #8
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    I did mean E4 on the end as you caught

  9. #9
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    So what do you want excel to count in a yes/yes situation??

    Edit @ 17:51 LoL... I made a Jeremy Hunt mis-spelling first time round and the auto-censor replaced my letters with ****
    Last edited by Glenn Kennedy; 07-18-2019 at 12:51 PM.

  10. #10
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    I want Excel to count the IFs for the Yes: =IF($F$5="YES",IF($F$6="YES",COUNTIFS(DATA!$D:$D,B$10,DATA!J:J,$F$7),IF($F$5="YES",COUNTIFS(DATA!$D:$D,B$10,DATA!$I:$I,$F$3,DATA!J:J,CALCULATION!$F$7),COUNTIFS(DATA!$B:$B,$F$2,DATA!$D:$D,B$10,DATA!$I:$I,$F$3,DATA!J:J,CALCULATION!$F$7))),IF($F$6="YES",COUNTIFS(DATA!$B:$B,$F$2,DATA!$D:$D,B$10,DATA!J:J,CALCULATION!$F$7),COUNTIFS(DATA!$B:$B,$F$2,DATA!$D:$D,B$10,DATA!$I:$I,$F$3,DATA!J:J,CALCULATION!$F$7)))

  11. #11
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    That formula does not seem to belong in your sample sheet. E4 has now vanished. Can you repost a sheet and formula that match each other? Is it your intention that if a DD is left blank, it will count "All"?

  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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    Hang on... I think I begin to follow this... Do nothing for a moment.

  13. #13
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    Try this:

    =COUNTIFS(OFFSET(DATA!$D:$D,,ROWS($1:1)-1,,),B$10,DATA!$B:$B,IF($E$2="All","<>",$E$2),DATA!$I:$I,IF($E$3="All","<>",$E$3),DATA!$H:$H,IF($E$4="All","<>",$E$4),DATA!$J:$J,IF($E$5="All","<>",$E$5))

    Not extensively checked...
    Attached Files Attached Files

  14. #14
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    IF that is correct, then this formula is slightly better:

    =COUNTIFS(INDEX(DATA!$D:$F,,ROWS($1:1)),B$10,DATA!$B:$B,IF($E$2="All","<>",$E$2),DATA!$I:$I,IF($E$3="All","<>",$E$3),DATA!$H:$H,IF($E$4="All","<>",$E$4),DATA!$J:$J,IF($E$5="All","<>",$E$5))

    It avoids the volatile OFFSET function.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    SOLVED...I simply did not have the IFs nested correctly with the AND function and had to us 'fx' to properly add ranges and criteria in my COUNTIFs. Not sure it was the most simplified way to get it done but I was able to get the desired outcome

  16. #16
    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,139

    Re: COUNTIFs: Multiple Cynamic Criteria

    Whatever... did you actually try the solution that I offered?

  17. #17
    Registered User
    Join Date
    07-18-2019
    Location
    Little Rock, AR
    MS-Off Ver
    2016
    Posts
    10

    Re: COUNTIFs: Multiple Cynamic Criteria

    Hi yes I did try and I did not get the desired outcome.

+ 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] Countifs multiple criteria- criteria if cell is greater than another i adjacent column
    By Sircool1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2018, 11:23 AM
  2. [SOLVED] COUNTIFS with Multiple Text Criteria in Same Criteria Range
    By xl2016 in forum Excel General
    Replies: 5
    Last Post: 06-18-2017, 05:00 AM
  3. Countifs with multiple criteria in single criteria range
    By SUHAS KARHADKAR in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-01-2016, 10:55 AM
  4. Countifs with multiple criteria in single criteria range
    By MCP313 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-01-2016, 03:51 AM
  5. [SOLVED] countifs statement with multiple criteria for multiple criteria ranges
    By mcdermott2 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-07-2015, 11:48 AM
  6. [SOLVED] Countifs multiple criteria, and 1 criteria Less than & Greater than
    By david gonzalez in forum Excel General
    Replies: 4
    Last Post: 06-30-2014, 10:33 PM
  7. [SOLVED] Countifs with multiple criteria and one criteria has a list of names
    By Beefy1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2014, 05:25 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