ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Countif depending on the conditions across multiple columns (https://www.excelbanter.com/excel-worksheet-functions/188144-countif-depending-conditions-across-multiple-columns.html)

San

Countif depending on the conditions across multiple columns
 
How can I count the no. of rows in a sheet depending on the values in 2
columns ?

Eg:
Suppose I have two columns in an excel sheet viz

ColA ColB
1 1
2 1
1 2
2 1
1 2
2 0
2 1


I want to count the nos. of 1's in colB iif value in colA for the same row
is "2" ?
I dont want to use a filter.

Result for above example should be:
The count result for the above example should be 3 due to following 3 rows
ColA ColB
2 1
2 1
2 1

vsoler

Countif depending on the conditions across multiple columns
 
On May 20, 12:01*pm, san wrote:
How can I count the no. of rows in a sheet depending on the values in *2
columns ?

Eg:
Suppose I have two columns in an excel sheet viz

ColA * ColB
1 * * * 1
2 * * * 1
1 * * * 2
2 * * * 1
1 * * * 2
2 * * * 0
2 * * * 1

I want to count the nos. of 1's in colB iif value in colA for the same row
is "2" ?
I dont want to use a filter.

Result for above example should be:
The count result for the above example should be 3 due to following 3 rows
ColA * ColB
2 * * * 1
2 * * * 1
2 * * * 1


Use SUMPRODUCT:

=SUMPRODUCT((A1:A7=2)*(B1:B7=1))



All times are GMT +1. The time now is 12:09 AM.

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