How to Count the rows meeting the criteria?

gnaga

Well-known Member
Joined
Jul 9, 2002
Messages
748
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Hi,

My data is spread into three columns and 100 rows. (A1:C100). I would like to count the rows based on the values in each column. Example as given below.

A B C
1 1 1 1
2 -1 -1 -1
3 1 -1 0
4 -1 0 1
5 1 1 1
.
.
.
100

For criteria = 1 count of rows = 2 (Row 1 & 5)
For criteria = -1 count of rows = 1 (Row 2)

How can I use the countif or sumif to get this?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
1. For criteria = 1:

=COUNTIFS($A$1:$A$100,1,$B$1:$B$100,1,$C$1:$C$100,1)

2. For criteria = -1:

=COUNTIFS($A$1:$A$100,-1,$B$1:$B$100,-1,$C$1:$C$100,-1)
 
Upvote 0
Thanks Phuoc...It is working fine.

One more request - I would like to find only for either of two column combination (AB or BC or CA). How to add OR Condition?
 
Upvote 0
Try this:

=SUMPRODUCT(--(($A$1:$A$100=1)+($B$1:$B$100=1)+($C$1:$C$100=1)>=2))
 
Upvote 0
Solution
Thank you so much. It works fine.
 
Upvote 0

Forum statistics

Threads
1,216,113
Messages
6,128,905
Members
449,478
Latest member
Davenil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top