Countif with matrix

Rubsie

New Member
Joined
Feb 16, 2009
Messages
7
Hi,

I have the following table and I would like to count the amount of rows in which either column x, y OR z has a value greater than 0. I'm assuming this has to be done with an array formule as I do not want to create a helper column.
In the example below, the result of this calculation is 5 (rows A, C, D, F and G have a value in one of the 3 columns greater than 0).
xyz
A010
B000
C111
D001
E000
F110
G011

<tbody>
</tbody>

Does anyone know how to do this?
 
An exhibit for clarification along with the desired result would be helpful. Guessing from he short specs:

=SUM(IF(FREQUENCY(IF((B2:B8>0),IF(C2:C8>1,IF(D2:D8>2,ROW(A2:A8)))),ROW(A2:A8)),1))

which must be confirmed with control+shift+enter.

Thank you Aladin, this formula works great.
XOR LX, I can't seem to get yours working. I'd like to add the workbook with those two formula's but I do not have permission do so..
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
if you want to count a row when all of the conditions are satisfied try COUNTIFS like this

=COUNTIFS(A1:A7,">0",B1:B7,">1",C1:C7,">2")
 
Last edited:
Upvote 0
if you want to count a row when all of the conditions are satisfied try COUNTIFS like this

=COUNTIFS(A1:A7,">0",B1:B7,">1",C1:C7,">2")

Not all criteria have to be met, if only one (or two or all three) of them is met, it should count the row. That's why countifs doesn't work for me.
 
Upvote 0
Not all criteria have to be met, if only one (or two or all three) of them is met, it should count the row. That's why countifs doesn't work for me.

Bit then, what is the count regarding the exhibit that follows?

xyz
A010
B100
C123
D001
E1
2
0
F125
G011

<tbody>
</tbody>
 
Upvote 0
Not all criteria have to be met, if only one (or two or all three) of them is met, it should count the row. That's why countifs doesn't work for me.

Hi Rubsie,

Did you try my formula of the post #9?

If yes, what you got?

Here is the result with that formula:

xyzResult
A0134
B000
C123
D001
E000
F145
G111
*************************

<tbody>
</tbody>


Markmzz
 
Last edited:
Upvote 0
Assuming data in A1:C7, maybe...

=SUMPRODUCT(--(((A1:A7>0)+(B1:B7>1)+(C1:C7>2))>0))

M.
 
Upvote 0
I'm confused now.

If I now understand you correctly, my formula needs a slight amendment to:

=SUM(0+(MMULT(0+(A1:C7>{0,1,2}),TRANSPOSE(COLUMN(A1:C7))^0)>0))


And Markmzz - appears I may owe you an apology!

Regards
 
Last edited:
Upvote 0
Bit then, what is the count regarding the exhibit that follows?

xyz
A010
B100
C123
D001
E120
F125
G011

<tbody>
</tbody>

Assuming data in A1:C7, maybe...

=SUMPRODUCT(--(((A1:A7>0)+(B1:B7>1)+(C1:C7>2))>0))

M.

If that is the interpretation (what is desired), just for the record:

=SUM(IF(FREQUENCY(IF((B2:B8>0)+(C2:C8>1)+(D2:D8>2),ROW(A2:A8)),ROW(A2:A8)),1))
 
Upvote 0

Forum statistics

Threads
1,215,634
Messages
6,125,931
Members
449,274
Latest member
mrcsbenson

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