Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
aw aw is offline
external usenet poster
 
Posts: 19
Default function "sumproduct" in VBA environment

Dear Sir / Madam,

Could anyone can help to translate the worksheet function sumproduct (as
below) into VBA??


=SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard Trucks"),amt)

Remark : Yard, ac_name & amt are pre-defined range.


My working as follow : (but run-time error 13 type mismatch appear)

Sub sp()
a = InputBox("Yard")
b = InputBox("A/C name")
MyAns = Application.WorksheetFunction.SumProduct((Range("y ard") = "a"),
(Range("ac_name") = "b"), Range("amt"))
End Sub

!!!Thank you so much!!!

Best rgds // aw

--
aw
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default function "sumproduct" in VBA environment

Oops sorry, no equal sign needed:
MyAns = Evaluate("SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard
Trucks"),amt)")

HTH
Cordially
Pascal

"papou" a crit dans le message
de news: ...
Hello
If your sumproduct formula works, use Evaluate:
MyAns = Evaluate("=SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard
Trucks"),amt)")

HTH
Cordially
Pascal

"aw" a crit dans le message de news:
...
Dear Sir / Madam,

Could anyone can help to translate the worksheet function - "sumproduct"
(as
below) into VBA??


=SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard Trucks"),amt)

Remark : "Yard", "ac_name" & "amt" are pre-defined range.


My working as follow : (but run-time error '13' type mismatch appear)

Sub sp()
a = InputBox("Yard")
b = InputBox("A/C name")
MyAns = Application.WorksheetFunction.SumProduct((Range("y ard") = "a"),
(Range("ac_name") = "b"), Range("amt"))
End Sub

!!!Thank you so much!!!

Best rgds // aw

--
aw





Reply
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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
nesting "and" in sumproduct function George P Excel Discussion (Misc queries) 1 January 6th 07 07:40 PM
nesting "and" in sumproduct function George P Excel Discussion (Misc queries) 0 January 6th 07 07:22 PM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM
Set Focus in "Form" environment Tom Ogilvy Excel Programming 0 September 4th 03 05:55 PM


All times are GMT +1. The time now is 03:21 AM.

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

About Us

"It's about Microsoft Excel"