ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Multiple COUNTIF formula (https://www.excelbanter.com/excel-discussion-misc-queries/47780-multiple-countif-formula.html)

JaB

Multiple COUNTIF formula
 
Hi

Can anyone assist with a multiple COUNTIF formula. I basically want to
count two values in a range of cells. At the moment Im putting in entering
something like -
=COUNTIF(C:C,"XXXX") AND COUNTIF(C:C,"YYYY").
However, this is not working so Im assuming I should be using a command
other than 'AND' to link them.

Any help advice appreciate. Thanks in advance!

RagDyer

A few ways:

To follow your lead, try this:

=COUNTIF(C:C,"XXXX")+COUNTIF(C:C,"YYYY")

To combine them, use the Sum() finction:

=SUM(COUNTIF(C:C,{"XXXX","YYYY"}))

Or, the ever popular<g SumProduct():

=SUMPRODUCT(--(C1:C1000={"XXXX","YYYY"}))

--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"JaB" wrote in message
...
Hi

Can anyone assist with a multiple COUNTIF formula. I basically want to
count two values in a range of cells. At the moment Im putting in

entering
something like -
=COUNTIF(C:C,"XXXX") AND COUNTIF(C:C,"YYYY").
However, this is not working so Im assuming I should be using a command
other than 'AND' to link them.

Any help advice appreciate. Thanks in advance!



RagDyer

Forgot to mention that SumProduct cannot use entire column references (C:C).
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"RagDyer" wrote in message
...
A few ways:

To follow your lead, try this:

=COUNTIF(C:C,"XXXX")+COUNTIF(C:C,"YYYY")

To combine them, use the Sum() finction:

=SUM(COUNTIF(C:C,{"XXXX","YYYY"}))

Or, the ever popular<g SumProduct():

=SUMPRODUCT(--(C1:C1000={"XXXX","YYYY"}))

--
HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"JaB" wrote in message
...
Hi

Can anyone assist with a multiple COUNTIF formula. I basically want to
count two values in a range of cells. At the moment Im putting in

entering
something like -
=COUNTIF(C:C,"XXXX") AND COUNTIF(C:C,"YYYY").
However, this is not working so Im assuming I should be using a command
other than 'AND' to link them.

Any help advice appreciate. Thanks in advance!





All times are GMT +1. The time now is 04:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com