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.
Thanks for taking a look,
John
Sumproduct Assistance
-
- GoldLounger
- Posts: 2631
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
Sumproduct Assistance
You do not have the required permissions to view the files attached to this post.
Regards,
John
John
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Sumproduct Assistance
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"))
Result = af.SumIf(Range("A2:A7"), "D0002", Range("C2:C7"))
Best wishes,
Hans
Hans
-
- GoldLounger
- Posts: 2631
- Joined: 26 Jan 2010, 16:31
- Location: Southern California
Re: Sumproduct Assistance
Hans,
You made me chuckle. My original plan was to use the "SUMIF".
Many thanks,
John
You made me chuckle. My original plan was to use the "SUMIF".
Many thanks,
John
Regards,
John
John
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Re: Sumproduct Assistance
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.
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
Nannette
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Sumproduct Assistance
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
Hans