ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CountIf for multiple columns (https://www.excelbanter.com/excel-discussion-misc-queries/128559-countif-multiple-columns.html)

John English

CountIf for multiple columns
 
I am trying to collect the number of letters in a column that also have a
letter in another column.

Here is what I am trying to do:
I would like to combine to combine the two formulas below
countif(C21:C206,"Y") and countif(G21:G206,"E")

In other words, I would like a target cell to sum the number of rows that
have a "Y" in Column C and a "E" in Column G. Is this possible?

Thank you for your help.

Dave Peterson

CountIf for multiple columns
 
=sumproduct(--(c21:c206="y"),--(g21:g206="e"))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html



John English wrote:

I am trying to collect the number of letters in a column that also have a
letter in another column.

Here is what I am trying to do:
I would like to combine to combine the two formulas below
countif(C21:C206,"Y") and countif(G21:G206,"E")

In other words, I would like a target cell to sum the number of rows that
have a "Y" in Column C and a "E" in Column G. Is this possible?

Thank you for your help.


--

Dave Peterson

John English

CountIf for multiple columns
 
Thank you sir that did the trick.

"Dave Peterson" wrote:

=sumproduct(--(c21:c206="y"),--(g21:g206="e"))

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html



John English wrote:

I am trying to collect the number of letters in a column that also have a
letter in another column.

Here is what I am trying to do:
I would like to combine to combine the two formulas below
countif(C21:C206,"Y") and countif(G21:G206,"E")

In other words, I would like a target cell to sum the number of rows that
have a "Y" in Column C and a "E" in Column G. Is this possible?

Thank you for your help.


--

Dave Peterson



All times are GMT +1. The time now is 07:33 PM.

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