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 Workbook
ABCDEFGH
11457TRUE121
22344FALSE054
31284FALSE077
412854FALSE0
52183FALSE0
62375TRUE1
715474TRUE1
835465FALSE0
96765FALSE0
106843FALSE0
11353555FALSE0
12243545FALSE0
13243553FALSE0
141257TRUE1
152154FALSE0
161257TRUE1
17555
1aa
Excel 2003
Cell Formulas
RangeFormula
E17=COUNTIF(E1:E16,TRUE)
F17=SUM(F1:F16)
G17=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))
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.

Did you try Andrew's suggestion> See G17.

Unless you must use MMult, you could look at the above.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Upvote 0
I think you will still have problems with duplicates with all the solutions proposed so far, e.g. if C9 is changed to 7 then row 9 will be counted......but it doesn't contain all the numbers - either 1,4 and 7 or 2,5 and 7

If you have duplicates and you want to avoid that then try this formula

=SUMPRODUCT(((MMULT((COUNTIF(OFFSET(A1:D1,ROW(A1:D16)-ROW(A1),0),{1,4,7})>0)+0,{1;1;1})=3)+(MMULT((COUNTIF(OFFSET(A1:D1,ROW(A1:D16)-ROW(A1),0),{2,5,7})>0)+0,{1;1;1})=3)>0)+0)

that will only count a row if it contains either set of 3 numbers in their entirety. Clearly for these numbers it's not possible for any single row to contain both sets.....but if you change the numbers (or include more columns) then note that this version only counts any one row once - even if it was to contain more than one set of numbers
 
Upvote 0
Barry,

Sorry, I forgot about your post regarding duplicates.
 
Upvote 0
Thanks to everyone who spent time on this post! Thanks to Andrew who made the formula compact! Thanks to Dave Patton for his take! Barry the formula is great and your absolutly right with a larger data set there may be duplicates! Domenic I understood the other post that I put the link too, I was just referencing you or someone else would get an idea or have some of that magic that you seem to put in all of your posts. I am still amazed at the posts that come out of here!

Thanks you all again!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,716
Members
452,939
Latest member
WCrawford

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