+ Reply to Thread
Results 1 to 14 of 14

COUNTIF cells meet one criteria or another, but not both

  1. #1
    Registered User
    Join Date
    10-31-2017
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    COUNTIF cells meet one criteria or another, but not both

    Hi,
    I have a survey question in which the answers are 4, 5, 6 OR All of the above. Some of the respondents replied 4,5,or 6 but also replied All of the above. I want to count the response if the respondents replied 4,5,6 OR if they replied All of the above, but not both. The way I have it set up now is =COUNTIF(AK1085,"4")+COUNTIF(AK1085,"5")+COUNTIF(AK1085,"6")+COUNTIF(AD1085,"All of the above") but that is counting as 2 because the response fulfills both criteria. How do I set up the formula to count only once if the response is 4,5, or 6 OR All of the above?

    Thank you for your help!

  2. #2
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: COUNTIF cells meet one criteria or another, but not both

    Try
    =SUMPRODUCT(COUNTIF(AK1085,{4,5,6,"All of the above"}))

  3. #3
    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: COUNTIF cells meet one criteria or another, but not both

    I'm having trouble understanding your request. You don't need a countif for one cell. You could use an if statement for that. Something like
    =IF(AD1085="all of the above",1,IF(OR(AK1085=4,AK1085=5,AK1085=6),1,""))
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    10-31-2017
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Re: COUNTIF cells meet one criteria or another, but not both

    Sorry, I did not clarify, All of the above is in a different cell (AD1085). Is there a way to count if AK1085 equals 4, 5, or 6 OR if AD1085 equals All of the above? But again, if both criteria are true I only want it to calculate once.

  5. #5
    Registered User
    Join Date
    10-31-2017
    Location
    United States
    MS-Off Ver
    2010
    Posts
    3

    Re: COUNTIF cells meet one criteria or another, but not both

    Quote Originally Posted by Sambo kid View Post
    I'm having trouble understanding your request. You don't need a countif for one cell. You could use an if statement for that. Something like
    =IF(AD1085="all of the above",1,IF(OR(AK1085=4,AK1085=5,AK1085=6),1,""))
    This seems to work. Thank you!

  6. #6
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: COUNTIF cells meet one criteria or another, but not both

    I think Sambo kid's formula can be applied just change the cell reference accordingly
    If its not working Can you post a sample of your data

  7. #7
    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: COUNTIF cells meet one criteria or another, but not both

    this would also be a shorter version of what I gave you... =IF(AD1085="all of the above",1,IF(OR(AK1085,{4,5,6}),1,""))
    Last edited by Sam Capricci; 10-31-2017 at 12:03 PM.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: COUNTIF cells meet one criteria or another, but not both

    Or this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    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: COUNTIF cells meet one criteria or another, but not both

    AlKey, the problem is "all of the above" and 4, 5 and 6 are not located in the same cells, AD1085 and AK1085 respectively.

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: COUNTIF cells meet one criteria or another, but not both

    Quote Originally Posted by Sambo kid View Post
    AlKey, the problem is "all of the above" and 4, 5 and 6 are not located in the same cells, AD1085 and AK1085 respectively.
    Thanks Sam! I didn't realize that there were two different cells. Sorry about that.

  11. #11
    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: COUNTIF cells meet one criteria or another, but not both

    Thanks Sam! I didn't realize that there were two different cells. Sorry about that.
    nothing to apologize about, just wanted to point it out as to why mine was different.

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: COUNTIF cells meet one criteria or another, but not both

    But I think it should be = not comma
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    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: COUNTIF cells meet one criteria or another, but not both

    But I think it should be = not comma
    Ha Ha, YOU are right, thanks for the correction.

  14. #14
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: COUNTIF cells meet one criteria or another, but not both

    And this one a bit shorter by avoiding IF(OR
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. COUNTIF two adjacent cells meet logical criteria - help please!
    By Dave67 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-07-2017, 09:25 AM
  2. [SOLVED] COUNTIF on range of cells that meet 2 criteria
    By mattsafact in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-06-2016, 10:54 AM
  3. [SOLVED] Counting cells that meet multiple single criteria as variable criteria
    By BillBasil in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-01-2016, 10:33 AM
  4. [SOLVED] countif three successive cells meet a criteria
    By FerLab in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-09-2014, 04:32 PM
  5. Trying to countif 2 columns meet different criteria
    By ediancoc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-07-2013, 03:37 PM
  6. Countif all rows of a sheet that meet multiple criteria
    By yenaled in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-05-2013, 03:18 PM
  7. Using Countif to count cells that meet date criteria
    By Gooford in forum Excel General
    Replies: 2
    Last Post: 10-28-2010, 08:09 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