+ Reply to Thread
Results 1 to 16 of 16

Excel COUNTIFS not counting data correctly

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Excel COUNTIFS not counting data correctly

    I am summarizing a questionnaire where, out of 52 "Yes and No" questions (input as Y or N respectively), question 10, 19, 23, 24, 33, 37, 40, 45 that are answered Y need to be counted. I thought COUNTIFS would be my function of choice. This is the function I wrote:

    =COUNTIFS(Data!N2:Data!N2,"=Y",Data!W2:Data!W2,"=Y",Data!AA2:Data!AA2,"=Y",Data!AB2:Data!AB2,"=Y",Data!AK2:Data!AK2,"=Y",Data!AO2:Data!AO2,"=Y",Data!AR2:Data!AR2,"=Y",Data!AW2:Data!AW2,"=Y")

    I also tried without the duplicated cell:

    =COUNTIFS(Data!N2,"=Y",Data!W2,"=Y",Data!AA2,"=Y",Data!AB2,"=Y",Data!AK2,"=Y",Data!AO2,"=Y",Data!AR2,"=Y",Data!AW2,"=Y")

    And I tried without the equal sign:

    =COUNTIFS(Data!N2,"Y",Data!W2,"Y",Data!AA2,"Y",Data!AB2,"Y",Data!AK2,"Y",Data!AO2,"Y",Data!AR2,"Y",Data!AW2,"Y")

    I know items 23, 24, 33, 45 are answered Y, so the function should give me 4, but all of them give me 0.

    Help Please!

    In advance, thank you!

    Linda

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Excel COUNTIFS not counting data correctly

    Hi Linda,

    You should be able to just use...

    =COUNTIF(N2:AW2,"Y")

    ...change the range to match your actual range...
    HTH
    Regards, Jeff

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel COUNTIFS not counting data correctly

    If you want to count how many cells in row 2 contain "Y":

    =COUNTIF(Data!2:2,"Y")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Excel COUNTIFS not counting data correctly

    give us the sample files so we could help u faster

  5. #5
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    Quote Originally Posted by jeffreybrown View Post
    Hi Linda,

    You should be able to just use...

    =COUNTIF(N2:AW2,"Y")

    ...change the range to match your actual range...
    The problem with using the range N2:AW2 is that range includes data not specific to my summary. See a further reply below with more detail.

  6. #6
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    Jeffrey, Tony, and Azumi, Thank you for the suggestions, but let me give you more detail, because that may help find an answer that will work.

    I have 500 people answering 52 questions. The questions are set-up in a random order as an attempt to gather a true response and determine their opinion on 6 different Summaries. Some of the questions are bogus and won't be included in the results. Other answers are used in more than one of the 6 Summaries.

    The volunteers can either answer Yes or No. Data Entry will enter the Y or N respectively.

    My Data: I have the data input on my spreadsheet with the rows representing the volunteer and the columns representing the survey questions.

    My Summary: On a second tab, there are 7 columns; A=Volunteer, B=Summary1, C=Summary2, ...G=Summary6. Summary1 is the number of "Yes" answers to Questions 10, 19, 23, 24, 33, 37, 40, 45. Summary2 is the number of "Yes" answers to Questions 2, 6, 7, 8, 13, 35, 39, 42, 44. And so on... through Summary6 is the number of "Yes" answers to Questions 46, 48, 49, 51, 52.

    That is why I can't use the "range" suggestion nor the "row" suggestion. I need something that will allow me to specify which cells within the row I want to see a "Y" answer.

    Does this give enough background?

  7. #7
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    STATED ANOTHER WAY...

    Is there a way to name non-contiguous cells so they can be treated as a range?

    Thank you! L.

  8. #8
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Excel COUNTIFS not counting data correctly

    Try this

    =COUNTIF(Data!N2:Data!N2,"Y")+COUNTIF(Data!W2:Data!W2,"Y")+COUNTIF(Data!AA2:Data!AA2,"Y")+..........and so on

    maybe this is what u want?

    Azumi

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Excel COUNTIFS not counting data correctly

    Hi Linda,

    Ok, with your further explanation, if I understand correct, in row 1 you have a header which differentiates what columns should be added together.

    =COUNTIFS(A1:G1,"Summary1",A2:G2,"Y")
    =COUNTIFS(A1:G1,"Summary2",A2:G2,"Y")
    =COUNTIFS(A1:G1,"Volunteer",A2:G2,"Y")

    You can even place Summary and Volunteer, the key words in a cell and read off of that cell...

    J2 = Summary1
    J3 = Summary2
    J3 = Volunteer

    Now in K2 copied down...

    =COUNTIFS($A$1:$G$1,J2,$A$2:$G$2,"Y")

    Does this help?

  10. #10
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    Quote Originally Posted by azumi View Post
    Try this

    =COUNTIF(Data!N2:Data!N2,"Y")+COUNTIF(Data!W2:Data!W2,"Y")+COUNTIF(Data!AA2:Data!AA2,"Y")+..........and so on

    maybe this is what u want?

    Azumi
    THAT'S IT! Although, even less typing. Since it's "COUNTIF" I don't even need the range. I can use =COUNTIF(Data!N2,"Y")+COUNTIF(Data!W2,"Y")+COUNTIF(Data!AA2,"Y")+..........and so on. THANK YOU, so much!

  11. #11
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    Quote Originally Posted by jeffreybrown View Post
    Hi Linda,

    Ok, with your further explanation, if I understand correct, in row 1 you have a header which differentiates what columns should be added together.

    =COUNTIFS(A1:G1,"Summary1",A2:G2,"Y")
    =COUNTIFS(A1:G1,"Summary2",A2:G2,"Y")
    =COUNTIFS(A1:G1,"Volunteer",A2:G2,"Y")

    You can even place Summary and Volunteer, the key words in a cell and read off of that cell...

    J2 = Summary1
    J3 = Summary2
    J3 = Volunteer

    Now in K2 copied down...

    =COUNTIFS($A$1:$G$1,J2,$A$2:$G$2,"Y")

    Does this help?
    Jeffrey, Thank you for your reply. I think Azumi found the formula I needed. I appreciate your input!

  12. #12
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Excel COUNTIFS not counting data correctly

    You don't appear to need countif At all....

    It's just
    =(Data!N2="Y")+(Data!W2="Y")+(Data!AA2="Y")

  13. #13
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Excel COUNTIFS not counting data correctly

    ...but either with or without COUNTIF that would make things more complicated than you need. If you don't have a header row within the data showing which questions belong to which group then why not add one? Then you can use Jeff's suggestion.

    It should make it easier to maintain, especially if you want to change the groups, you'd only have to change the header row.....
    Audere est facere

  14. #14
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Excel COUNTIFS not counting data correctly

    Perhaps

    =SUMPRODUCT((COLUMN(2:2)={10;19;23;24;33;37;40;45})*(2:2="Y"))

    This could be better maintained if those numbers 10 19 23 etc are held in a range of cells, say A1:A8
    =SUMPRODUCT((COLUMN(2:2)=A$1:A$8)*(2:2="Y"))

    And performance further improved if we limit the range to the necessary columns instead of referring to whole rows..
    =SUMPRODUCT((COLUMN($A2:$AW2)=A$1:A$8)*($A2:$AW2="Y"))
    Last edited by Jonmo1; 08-22-2013 at 07:11 AM.

  15. #15
    Registered User
    Join Date
    07-18-2013
    Location
    Los Osos, CA
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    15

    Re: Excel COUNTIFS not counting data correctly

    Thank you, Jonmo1. I'll also give that a try. I didn't consider just adding a non-numeric entry.

  16. #16
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Excel COUNTIFS not counting data correctly

    Glad for your feedback Linda.....

    Azumi

+ 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. COUNTIFS not counting all numbers in one cell
    By taichi56 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-16-2013, 05:46 PM
  2. [SOLVED] Counting number of data that meets 2 criteria (sumproduct and countifs?)
    By tekobayashi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-26-2012, 02:30 AM
  3. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  4. Countifs not counting, returns #value
    By Qualo_Jinn in forum Excel General
    Replies: 3
    Last Post: 12-09-2011, 04:13 PM
  5. Array or countifs for counting survey responses
    By friendlylad in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-04-2009, 10:01 AM

Tags for this Thread

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