Countif with an array?

Spartin

New Member
Joined
Feb 25, 2014
Messages
35
Good Afternoon:

I am trying to write a formula that will count items in a column that have met one or more criteria in corresponding column, but without counting those items twice. A simple to table to illustrate is below. As it is laid out, I would look to count 4 total items (A, B, C, E) since they meet one or more of the criteria. D would not be counted. In my real life data set, the columns are marked with a "1" just like the illustration below.

Any suggestions?

Thanks


ItemCriterion 1Criterion 2Criterion 3Criterion 4
A1
B1
C11
D
E111

<tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Here is a little bit better illustration with cell references

ABCDEF
1ItemCriterion 1Criterion 2Criterion 3Criterion 4
2A1
3B1
4C11
5D
6E111

<tbody>
</tbody>
 
Upvote 0
Re: Here is a little bit better illustration with cell references

If we had this:

ItemCriterion 1Criterion 2Criterion 3Criterion 4
A1
A1
B1
C11
D
E111

<tbody>
</tbody>

would the count still equal to 4?
 
Upvote 0
Re: Here is a little bit better illustration with cell references

The count would still equal 4, but that scenario does not exist. The item's are unique, 8-digit order numbers. Thanks.
 
Upvote 0
I found a solution on another website. For reference:

Array formula = SUM(N(MMULT(N(C2:F6=1),TRANSPOSE(COLUMN(C2:F6)^0))>0))

Thanks Google!
 
Upvote 0
Re: Here is a little bit better illustration with cell references

The count would still equal 4, but that scenario does not exist. The item's are unique, 8-digit order numbers. Thanks.

Control+shift+enter, not just enter:

=SUM(IF(MMULT(ISNUMBER(B2:E6)+0,TRANSPOSE(COLUMN(B2:E6)^0)),1))
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,980
Members
448,934
Latest member
audette89

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