OK, I have the stats, which I have verified across a number of Macs. I
count on my buddy Dana, and you, to better inform me.
The fastest worksheet call I see is something like SUMPRODUCT(rng1,
rng2). I also tested it as an array-entered formula (hey, I look for
all possible tweaks and idiosyncracities within Excel), but no
difference there that I could detect across my set of platforms.
A formula like SUMPRODUCT(rng1*rng2), however entered, as tested across
a broad range of Macs, is about 20% slower. OK, OK, the average was
21.875, but wth.
Finally, using an array-entered SUM(rng1*rng2), which of course works
back through lots of previous versions of Excel, I took an average hit
of about 46%.
Bottom line, for me, is to use SUMPRODUCT(x,y) wherever possible, not
array-entered, unless someone can come up with a faster alternative.
I await your Windows tests.
Regards,
Dave Braden
Excel 10, as implemented for the Mac's OS-X, is about 32% slower when
doing something like SUM(rng1*rng2), where the formula is "array
entered", than using SUMPRODUCT(rng1,rng2). This frankly surprises me,
I'm also surprised: Would you check whether this difference in speed is due
to the *native* comma syntax of SumProduct?
Thus:
{=SUM(rng1*rng2)}
Vs
=SUMPRODUCT(rng1*rng2)
I expect these two to share the same set of procudures/routines to
accomplish the intended result, so they should take all things being equal
the same amount time.
I've never seen the weighted average formula built with SumProduct other
than with the _comma_ sysntax, although we see lots of SumProduct formulas,
unnecessarily using a _star_ syntax like in:
=SUMPRODUCT((rng1 RelOp cond1)*(rng2 RelOp cond2)*rng3)
instead of the kosher
=SUMPRODUCT(--(rng1 RelOp cond1),--(rng2 RelOp cond2),rng3). or even
=SUMPRODUCT((rng1 RelOp cond1)*(rng2 RelOp cond2),rng3)
One advantage of the comma syntax is that it tolerates text values in the
vectors that are multiplied:
=SUMPRODUCT(A1:A4,B1:B4)/SUM(A1:A4)
for example will not flounder by the existence of a formula-blank ("") in
B1, due to the formula, say, =IF(G1,1,"").
David J. Braden said:
Followup...
Excel 10, as implemented for the Mac's OS-X, is about 32% slower when
doing something like SUM(rng1*rng2), where the formula is "array
entered", than using SUMPRODUCT(rng1,rng2). This frankly surprises me,
but I am happy to know that Microsoft plods ahead. I would appreciate
someone letting me know how things stand on a recent Windows version of
Excel. So, from my perspective, not only does Mike's initial suggestion
make sense, as Geoff puts it, from a self-documenting perspective, but
has *very* strong grounding from hard-core performance perspecitves.
Sheesh, I'll bet Mike didn't even realize that (kidding, Mike!)
Again, any and all countervailing evidence to this would be greatly
appreciated. But I've a strong hunch that the observation will stand.
Regards,
DaveB
[/QUOTE]