Oring MMULT?

planetpj

Active Member
Joined
Jun 25, 2002
Messages
351
Good Morning,

I am trying to figure out a way to OR isnumber match inside my MMULT formula. I can get the formula to work if I use the same line twice but I am trying toi condense the formula to a more compact one could anyone please help me condense this?

=SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(A1:D16,{2,5,7},0)),{1;1;1;1})=3))+SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(A1:D16,{1,4,7},0)),{1;1;1;1})=3))

This is the idea that I am looking for
=SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(A1:D16,{2,5,7}*(--ISNUMBER(MATCH(A1:D16{1,4,7},0)),{1;1;1;1})=3))

Thanks in advance!

Book1
ABCD
11457
22344
31284
412854
52183
62375
715474
835465
96765
106843
11353555
12243545
13243553
141257
152154
161257
Sheet1
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Can you describe what you are trying to achieve with your formula?
 
Upvote 0
The formula is trying to count if {2,5,7} or {1,4,7} occur in a row. It will total up to 5. The formula below works but I know that there is a way to condense it.

=SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(A1:D16,{2,5,7},0)),{1;1;1;1})=3))+SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(A1:D16,{1,4,7},0)),{1;1;1;1})=3))
 
Upvote 0
I think the correct syntax is

=SUMPRODUCT( --(MMULT(ISNUMBER(MATCH(A1:D16, {2,5,7})) * ISNUMBER(MATCH(A1:D16, {1,4,7}, 0)), {1;1;1;1}) = 3))

... but it calculates something different to your first formula, i.e., the cases where the conditions are simutaneously true versus summing the cases where either condition is true.
 
Upvote 0
You would use + for OR, like this:

=SUMPRODUCT(--(MMULT(ISNUMBER(MATCH(A1:D16,{2,5,7},0))+ISNUMBER(MATCH(A1:D16,{1,4,7},0)),{1;1;1;1})>3))

but that won't work because you are testing each array separately. With the formula above row 15 passes the test because it's 2+2.
 
Upvote 0
Code:
Thanks for the response, I am getting a 0 with that formula
Yup -- the conditions are mutually exclusive, so it will always return 0. I see what you want to do, and the formula I posted doesn't do it.
 
Upvote 0
Only slightly more comact:

=SUMPRODUCT((MMULT(--ISNUMBER(MATCH(A1:D16,{2,5,7},0)),{1;1;1;1})=3)+(MMULT(--ISNUMBER(MATCH(A1:D16,{1,4,7},0)),{1;1;1;1})=3))
 
Upvote 0
In your example some rows have repeated numbers - given that your formula would count a row that contains, say, 1,1,7 and 8....I assume you don't want to do that?
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

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