Counting based on conditions

excel_padwan

New Member
Joined
Aug 20, 2009
Messages
24
So, I've been out of the excel game for a while now and I'm finding I need to get back in. It's true that you lose it if you don't use it. So, I'm finding myself in the following situation.

I have a column, a value of 1-4 in each cell. I need to be able to take that column's values, and based on if a cell in that column contains a 1, find the count of another column that contains a specific value. So, for example.

I thought it would be this formula, but it's not working right.

=IF(COUNTIF(A2:A1106,1),(COUNTIF(BD2:BD1106,1)),0)

That counts all the cells in bd regardless if a has a one in that row or not.

Thank you for any suggestions.
J
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
So, I've been out of the excel game for a while now and I'm finding I need to get back in. It's true that you lose it if you don't use it. So, I'm finding myself in the following situation.

I have a column, a value of 1-4 in each cell. I need to be able to take that column's values, and based on if a cell in that column contains a 1, find the count of another column that contains a specific value. So, for example.

I thought it would be this formula, but it's not working right.

=IF(COUNTIF(A2:A1106,1),(COUNTIF(BD2:BD1106,1)),0)

That counts all the cells in bd regardless if a has a one in that row or not.

Thank you for any suggestions.
J
Maybe one of these...

For ALL versions of Excel:

=SUMPRODUCT(--(A2:A1106=1),--(BD2:BD1106=1))

For Excel 2007 and later:

=COUNTIFS(A2:A1106,1,BD2:BD1106,1)

The COUNTIFS version is more efficient if you can use it.
 
Upvote 0
Solved! Both ways work great. Thank you both for the response, this will certainly help my data sorting go by quicker.

-J
 
Upvote 0

Forum statistics

Threads
1,224,575
Messages
6,179,637
Members
452,934
Latest member
Jdsonne31

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