LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Michael
 
Posts: n/a
Default Using SumProduct in VB

I was hoping someone can help me.

I am writing a script that parses though an excel file and extract the
unique entries and sums the quantities with respect to certain criteria (ie
Month or Year). I currently have an excel formula that does what I am looking
for, but I need to convert it to a VB script.

The formula looks like:

=SUMPRODUCT(($C$2:$C$30="boxes")*($E$2:$E$30="Janu ary")*($D$2:$D$30))

Where C2:C30 contains the item, E2:E30 is the month, and D2:D30 contains
the quantity of the items. So this example counts the number of boxes from
January in this data range.


In my script, I am trying to write:

Sheets("Summary").Cells(n, 4) =
Application.WorksheetFunction.SumProduct((Range("C 2:C30") = "boxes")
*(Range("E2:E30") = "January")* (Range("D2:D60")))

However, when I run it, I get a "Run-time 13 error : Type mismatch" error. I
have been unable to debug this statement. So I was hoping someone could help
me with this.

I greatly appreciate any assistance you could provide.

Thanks,

-Michael
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct Peter B Excel Worksheet Functions 1 March 7th 05 01:59 PM
sumproduct causing memory errors? dave Excel Worksheet Functions 1 March 3rd 05 09:31 AM
Can I reference =, <, or > sign in SUMPRODUCT BobT Excel Discussion (Misc queries) 7 February 16th 05 01:58 PM
Sumproduct function not working Scott Summerlin Excel Worksheet Functions 12 December 4th 04 05:15 AM
adding two sumproduct formulas together ski2004_2005 Excel Worksheet Functions 1 November 12th 04 09:08 PM


All times are GMT +1. The time now is 07:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"