Sumproduct Assistance

jstevens
GoldLounger
Posts: 2631
Joined: 26 Jan 2010, 16:31
Location: Southern California

Sumproduct Assistance

Post by jstevens »

I'm having a challenge with the following and must be overlooking the obvious trying to replicate the formula in Cell F5 with a VBA equivalent.
untitled.png
Thanks for taking a look,
John
You do not have the required permissions to view the files attached to this post.
Regards,
John

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Sumproduct Assistance

Post by HansV »

This is a "trick" use of SumProduct that doesn't work in VBA. (In general , you can't use Application.WorksheetFunction to evaluate array formulas.) You can use SumIf instead:

Result = af.SumIf(Range("A2:A7"), "D0002", Range("C2:C7"))
Best wishes,
Hans

jstevens
GoldLounger
Posts: 2631
Joined: 26 Jan 2010, 16:31
Location: Southern California

Re: Sumproduct Assistance

Post by jstevens »

Hans,

You made me chuckle. My original plan was to use the "SUMIF".

Many thanks,
John
Regards,
John

User avatar
teachesms
2StarLounger
Posts: 170
Joined: 05 Feb 2010, 18:04
Location: Jacksonville, NC

Re: Sumproduct Assistance

Post by teachesms »

Can't help myself here...The SumIf is great! But...
I really like the "Conditional Sum Wizard" to do the work for me...especially if I have more then one condition. Have you tried it before? If not, it is worth a try...
http://microsoftword.biz/PDFS/The%20New ... %20Sum.pdf

Pages 4-5 go over the Wizard.

You may have to go to the Excel Windows Logo...Excel Options...Add Ins...Go button and add the Conditional Sum Wizard to the Formula bar first, as it is not there by default.
If you can't convince them, confuse them - Harry S. Truman

Nannette

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Sumproduct Assistance

Post by HansV »

The Conditional Sum Wizard helps you create SUMIF formulas in your worksheet. John was trying to use VBA to calculate a conditional sum.
Best wishes,
Hans