Sumproduct to Table...

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,124
Does anyone know of a utility / function or have themselves coded something that permits an end user to analyse a given Sumproduct formula in greater detail - ie returning the results of the generated array into tabular form ?

I've just sat down thinking this would be quite useful, ie I click on any sumproduct formula and run a routine to "Analyse" which in turn generates a new sheet with a matrix of the results...

However having just started coding this myself it is now dawning on me that this could prove very difficult (read beyond my abilities) ... breaking out the formula itself etc into component parts is pretty easy but actually evaluating each part is a little more difficult.

I suspect someone knows of an elegant way to do this and I'd love to see it... it may of course be that you can do this already but I don't know how...

Thanks,
Luke
 
Last edited:
It took me so long to post I missed Rory's but at least I was along the right lines which is reassuring... Rory I would say that the

Code:
On Error GoTo Fatality:

line should still exist prior to the initial Evaluation command in case the formula is invalid... it could be left in as is too (ie post Resume Next) rather than the GoTo 0 statement I had in earlier...

EDIT: Ignore me...
(like I need to say it ;-))
 
Last edited:
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Yes habit of mine from my .net stuff... soz.

I am sure there will be plenty of room for streamlining the code... there normally is where I'm involved :-0
 
Upvote 0
Oops - I forgot to adapt my credits line from this:
Code:
'tough bits coded by messrs. rorya, RichardSchollar & CornflakeGirl (aka Rory, Richard & Emma)
to this:
Code:
'tough bits coded by messrs. rorya, RichardSchollar & CornflakeGirl (muliebrity notwithstanding) - a.k.a. Rory, Richard & Emma.
 
Upvote 0
Emma, regards multitude of operators.

I *think* you would always have to assume one given rules, namely:

A comma always supercedes an asterisk as an operator

the former could never appear outside of parentheses acting as anything but a delimiter (semi colon regional settings aside), whereas the latter could (loosely) , eg

=SUMPRODUCT(--(A1:A100<70),A1:A100*B1:B100)
where A1:A100 contains =ROW() and B1:B100 = A1+1

I say loosely because in the above you're interpreting A1:A100*B1:B100 as 1 "component" when technically I guess you could argue that it is in fact two.

Given the above I think to permit both comma and asterisk delimiters you would have to jump to the assumption that any asterisk appearing outside of parentheses (ie where running parentheses count = 0) is a delimiter ... continuing the above example this would mean returning 3 columns (if you wished to run with 2 delimiter option), eg

Col B: A1:A100<70
Col C: A1:A100
Col D: B1:B100

with Col E: result

it would be impossible to differentiate / ascertain as to whether or not the user intended to see the A1:A100*B1:B100 as one argument or two...

So I guess my point would be probably best to leave as an either/or else you risk returning more data than end user expected to see...

What do you guys think ?
 
Upvote 0
I think making the * into a delimiter breaks the calculation down into more obvious chunks.

One thought though - you probably need something that handles when * is doing matrix multiplication rather than working as a delimiter, eg:

Excel Workbook
BCDEF
4523456
46
4747
4848
4949
5050
5151
52
53
544900
Sheet1


Excel Workbook
ABCD
1Formula Location:Sheet1!C54
2Formula:=SUMPRODUCT(B45:F45*B47:B51)
3Result:4900
4
5Component Part(s):"B45:F45""B47:B51"
6
7Row/Column:Result:Total(s)
824794
9348144
10449196
11550250
12651306
SPA_231008_124945
 
Upvote 0

Forum statistics

Threads
1,225,410
Messages
6,184,830
Members
453,263
Latest member
LoganAlbright

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