SUMPRODUCT with embed (INDEX MATCH) calculates incorrectly on a 1x1 array but correctly in a 1 x N array

cmcgonag

New Member
Joined
Aug 11, 2017
Messages
1
I am trying to run this bit of code as an array equation:

=SUMPRODUCT(INDEX('TEST DB'!C:C,MATCH(M1&(INDEX($C:$C,MATCH(OFFSET($A$2,,,$M$4+$M$3+1)+M2-$M$4,B:B,1))),'TEST DB'!A:A&'TEST DB'!B:B,0)))

Offset A2 is a helper column from 1 to 1000, M2, 3, 4 are integers, creating an array of certain size then filling that array with a sequential set of numbers. This array then converts those numbers to text using Column B and C. I need the index and match function because the match between text and ints in the offset array are not exact (otherwise I would use a sumproduct search method). From there the next index match searches a DB (very large) of two different values, M1, and the newly created text array. This creates a single array of the sampled parameter within the DB. The sumproduct then sums up the newly sampled array.

Here is the problem. If I run this code on two cells, think highlighting A2:B2, or any array larger than 1x1, and hit Ctrl+Shift+Enter. The math is correct, and cells A2:B2, are both populated with the correct answer. If I run it Ctrl+Shift+Enter, on just a 1x1 array (single cell) it pulls just the first value of the embedded array. Why does it run correctly on a 1xn array but not a 1x1? Also, subtotal and aggregate pull just the first parameter in the array, when running it like this. Why is that?

I cant use helper columns because of the size of the workbook. This code is like 100KB vs a method with helper columns is around 20MB. I need this to scale, so trading processor time for memory is a must.

Also, we cant use VBA.

Any insight is appreciated.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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