Sumproduct VBA Conversion

  • Thread starter Thread starter John Wilson
  • Start date Start date
J

John Wilson

Okay, so Sumproduct is not my forte.
I rarely use it.

I have this formula on a worksheet:

=SUMPRODUCT((L5:L1000="Boston Garden {2}")*(S5:S1000))

How can I convert this to VBA??

Thanks,
John
 
you could loop through the cells or just let excel help your code:

MsgBox _
Application.Evaluate("SUMPRODUCT((L5:L1000=""Boston Garden {2}"")*(S5:S1000))")

(kind of feels like cheating, though.)
 
John

Try

MsgBox Evaluate("=sumproduct((L5:L1000=""Boston Garden {2}"")*(S5:S1000))")

Tony

----- John Wilson wrote: -----

Okay, so Sumproduct is not my forte.
I rarely use it.

I have this formula on a worksheet:

=SUMPRODUCT((L5:L1000="Boston Garden {2}")*(S5:S1000))

How can I convert this to VBA??

Thanks,
John
 
Dave,

When I looked at your reply, my first thought was "I already tried
that 100 times in 100 different variations and I know it won't work!!!"

But I copied and pasted your conversion in the immediate window
just to prove my point and I'll be damned if it didn't give me exactly
the result that I was looking for. How could that be?!?!?!?!

I'm sure this won't be the last time that those double quotes will give
me an Excedrin headache.

Thanks a million,
John
 
Tony,

Thanks.
Already rec'd the same answer from Dave.
I neglected to notice those quote marks when I was trying to convert this.

John
 
When it gets really confusing, I'll use: chr(34) instead of """" (is that
enough of them???)
 
Back
Top