Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default sumproduct question

Below is an excert of code:

Dim rng As Range
Dim rng2 As Range
Dim tarrng As Range

Set rng = ActiveCell
Set rng2 = ActiveCell.End(xlDown)
Set tarrng = Range(rng, rng2)

tarrng.Select


BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((tarrng=" & ProVa &
")*(tarrng<0)")


BufYes is returning a #value error. Variations of this code works. I know
the current problem rests in the tarrng variable but I am not sure why. ???
--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default sumproduct question

BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((" & _
tarrng.Address & "=" & ProVa & ")*(" & _
tarrng.Address & "<0))")

--
Regards,
Tom Ogilvy


"Shawn" wrote in message
...
Below is an excert of code:

Dim rng As Range
Dim rng2 As Range
Dim tarrng As Range

Set rng = ActiveCell
Set rng2 = ActiveCell.End(xlDown)
Set tarrng = Range(rng, rng2)

tarrng.Select


BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((tarrng=" & ProVa &
")*(tarrng<0)")


BufYes is returning a #value error. Variations of this code works. I

know
the current problem rests in the tarrng variable but I am not sure why.

???
--
Thanks
Shawn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default sumproduct question

Same error. I tried double quotes too "" & & "" and "" "" and triple
quotes and no quotes. ???


--
Thanks
Shawn


"Tom Ogilvy" wrote:

BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((" & _
tarrng.Address & "=" & ProVa & ")*(" & _
tarrng.Address & "<0))")

--
Regards,
Tom Ogilvy


"Shawn" wrote in message
...
Below is an excert of code:

Dim rng As Range
Dim rng2 As Range
Dim tarrng As Range

Set rng = ActiveCell
Set rng2 = ActiveCell.End(xlDown)
Set tarrng = Range(rng, rng2)

tarrng.Select


BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((tarrng=" & ProVa &
")*(tarrng<0)")


BufYes is returning a #value error. Variations of this code works. I

know
the current problem rests in the tarrng variable but I am not sure why.

???
--
Thanks
Shawn




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default sumproduct question

In contrast, the immediate window indicates it works fine for me a posted:

Set tarrng = Range("A1:A10")
prova = 5

? ("=SUMPRODUCT((" & _
tarrng.Address & "=" & ProVa & ")*(" & _
tarrng.Address & "<0))")

=SUMPRODUCT(($A$1:$A$10=5)*($A$1:$A$10<0))

? Evaluate("=SUMPRODUCT((" & _
tarrng.Address & "=" & ProVa & ")*(" & _
tarrng.Address & "<0))")

0

Assumes ProVa is a number. If it is a string

Set tarrng = Range("A1:A10")
prova = "Dog"

? ("=SUMPRODUCT((" & _
tarrng.Address & "=""" & ProVa & """)*(" & _
tarrng.Address & "<0))")
=SUMPRODUCT(($A$1:$A$10="Dog")*($A$1:$A$10<0))

? Evaluate("=SUMPRODUCT((" & _
tarrng.Address & "="" & ProVa & "")*(" & _
tarrng.Address & "<0))")
0

--
Regards,
Tom Ogilvy


"Shawn" wrote in message
...
Same error. I tried double quotes too "" & & "" and "" "" and triple
quotes and no quotes. ???


--
Thanks
Shawn


"Tom Ogilvy" wrote:

BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((" & _
tarrng.Address & "=" & ProVa & ")*(" & _
tarrng.Address & "<0))")

--
Regards,
Tom Ogilvy


"Shawn" wrote in message
...
Below is an excert of code:

Dim rng As Range
Dim rng2 As Range
Dim tarrng As Range

Set rng = ActiveCell
Set rng2 = ActiveCell.End(xlDown)
Set tarrng = Range(rng, rng2)

tarrng.Select


BufYes.Value = WSDSD.Evaluate("=SUMPRODUCT((tarrng=" & ProVa &
")*(tarrng<0)")


BufYes is returning a #value error. Variations of this code works. I

know
the current problem rests in the tarrng variable but I am not sure

why.
???
--
Thanks
Shawn






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
=SUMPRODUCT() Question Harvey[_2_] Excel Discussion (Misc queries) 4 August 10th 08 09:42 PM
SUMPRODUCT Question Karen Smith Excel Discussion (Misc queries) 6 December 21st 07 10:56 AM
SUMPRODUCT Question Karen Smith Excel Discussion (Misc queries) 1 December 19th 07 03:46 PM
SUMPRODUCT question juliejg1 Excel Worksheet Functions 3 December 14th 07 08:10 PM
another sumproduct question cjjoo Excel Worksheet Functions 1 October 11th 05 03:43 AM


All times are GMT +1. The time now is 05:15 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"