Share via

Why this COUNTIFS function is not working?

Anonymous
2013-03-20T11:34:13+00:00

I have a data sheet named 101 which includes student information. The Column C Heading is "Session" having data like 2010-11; 2011-12; 2009-10; 2008-09; 2013

In another sheet, I wrote a COUNTIFS formula to determine how many students are there of the session 2010-11;2011-12 and 2013. The formula looks like this:

=COUNTIFS('101'!C1:C324,"2010-11",'101'!C1:C324,"2011-12",'101'!C1:C324,"2013")

But this is returning zero.

Why?

How to revise the formula?

Help please.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-03-20T12:09:09+00:00

Is there any easy way except the one you mentioned above?

I have not mastered the SUMPRODUCT formula.

If you think that there is no other way, pls explain the  formula you framed.

How many dashes here after the first bracket? in =SUMPRODUCT(--(

Hi,

If you don't like SUMPRODUCT then you can do it like this. With this formula it doesn't matter if 2013 is text or a number it will be counted

=COUNTIF('101'!C1:C324,"2010-11")+COUNTIF('101'!C1:C324,"2011-12")+COUNTIF('101'!C1:C324,"2013")

With the sumproduct formula this ISNUMBER(MATCH bit test every cell in the range for any of the 3 values and it returns an array of TRUE:FALSE etc. SUMPRODUCT can't work with TRUE ot FALSE so we use the -- to coerce TRUE into 1 and FALSE into zero and then sumproduct adds them up.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Anonymous
2013-03-20T11:43:10+00:00

Hi,

It's not working because a cell in that range cannot simultaneously be all of those values, try it this way

=SUMPRODUCT(--(ISNUMBER(MATCH('101'!C1:C234,{"2010-11","2011-12","2013"},0))))

A works of caution. It will work if these are text values but 2013 may well be a number and you may need to change the formula to this. Note in this version the quotes around 2013 are gone

=SUMPRODUCT(--(ISNUMBER(MATCH('101'!C1:C234,{"2010-11","2011-12",2013},0))))

Was this answer helpful?

0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-03-20T12:07:36+00:00

    The double unitary negation (two negative signs ( as in =SUMPRODUCT(--(Test) ,,,) are used to coerse the results of Test from Boolean (FALSE or TRUE) to numeric (0 or 1) so we can do arithmetic on them

    Bob Philips website on SUMPRODUCT:

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html#new

    best wishes

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-03-20T12:05:19+00:00

    Hi,

     

    It's not working because a cell in that range cannot simultaneously be all of those values, try it this way

     

     

    =SUMPRODUCT(--(ISNUMBER(MATCH('101'!C1:C234,{"2010-11","2011-12","2013"},0))))

     

     

    A works of caution. It will work if these are text values but 2013 may well be a number and you may need to change the formula to this. Note in this version the quotes around 2013 are gone

     

     

    =SUMPRODUCT(--(ISNUMBER(MATCH('101'!C1:C234,{"2010-11","2011-12",2013},0))))

    The formula is returning wrong result.

    I filtered the column and found 323 counts but your formula gives 230

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-03-20T11:58:30+00:00

    Is there any easy way except the one you mentioned above?

    I have not mastered the SUMPRODUCT formula.

    If you think that there is no other way, pls explain the  formula you framed.

    How many dashes here after the first bracket? in =SUMPRODUCT(--(

    Was this answer helpful?

    0 comments No comments