ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional Countif (https://www.excelbanter.com/excel-discussion-misc-queries/151993-conditional-countif.html)

Nancy

Conditional Countif
 
I am trying to check two conditions in one worksheet and if true report in
another. So for example in worksheet "ABC" I want to count !B1:!B20 if it
equals "apples" and !C1:!C20 if it equals "oranges". If both conditions are
true I want to return 1 to the answer in worksheet "XYZ".
Thanks
--
nancy

Peo Sjoblom

Conditional Countif
 
=SUMPRODUCT(--(B1:B20="apples"),--(C1:C20="oranges"))

replace the hardcoded values with cell references when you can put the
criteria
that way you don't need to edit the formula if you change the criteria


--
Regards,

Peo Sjoblom



"nancy" wrote in message
...
I am trying to check two conditions in one worksheet and if true report in
another. So for example in worksheet "ABC" I want to count !B1:!B20 if it
equals "apples" and !C1:!C20 if it equals "oranges". If both conditions
are
true I want to return 1 to the answer in worksheet "XYZ".
Thanks
--
nancy




Jim Thomlinson

Conditional Countif
 
I would be inclined to us a SumProduct like this...
=SUMPRODUCT(--($B$1:$B$20="Apples"), --($C$1:$C$20="Oranges"))
Check out this link for a further explanation...
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
--
HTH...

Jim Thomlinson


"nancy" wrote:

I am trying to check two conditions in one worksheet and if true report in
another. So for example in worksheet "ABC" I want to count !B1:!B20 if it
equals "apples" and !C1:!C20 if it equals "oranges". If both conditions are
true I want to return 1 to the answer in worksheet "XYZ".
Thanks
--
nancy



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

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