Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Macro wtih sumproduct 2 help

hello, i though my problem was solved by it is not
i am not able to make my function to work, it is govong me #value! for
a result

here is my sub
-------------------------------------------------------
Sub test()

Dim numberOfViolations As Variant 'if i will declare this as long
getting type mismatch

For i = 7 To 500

If Sheets("Summary").Cells(i, "A").Value = "" Then
Exit Sub
End If
numberOfViolations =
[SUMproduct((Detail!$B$7:$B$500=$A$"&i&")*(Detail!$ D$7:$D$500="Offender
Missed Call (STaR)"))]
Sheets("Summary").Cells(i, "I").Value = numberOfViolations
Next i
End Sub
----------------------------------------------

when compiling it is not giving me any errors, its just simply doesnt
work
gives me #value! as i said before.

PS! what i am trying to do is to count how many entries in detail meet
that criteria from formula, first critera will be alway different and
it will be taken from A7, A8, A9, thats why i dont have a specific name
there and i used $A$"&i&" as one guy suggested from my previous post,
please really need help, thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro wtih sumproduct 2 help

Have you tried to debug your code by stepping through it? When you do
that you will see where the value is not getting assigned to the
variable that you expect it to be assigned to. Just position the cursor
over the variables as you go through each line of code. When you get
to the problem variable, you'll know what needs to be fixed.
I know you wanted someone to tell you what was wrong with your code but
I think that this can help as well.

Harold
wrote:
hello, i though my problem was solved by it is not
i am not able to make my function to work, it is govong me #value! for
a result

here is my sub
-------------------------------------------------------
Sub test()

Dim numberOfViolations As Variant 'if i will declare this as long
getting type mismatch

For i = 7 To 500

If Sheets("Summary").Cells(i, "A").Value = "" Then
Exit Sub
End If
numberOfViolations =
[SUMproduct((Detail!$B$7:$B$500=$A$"&i&")*(Detail!$ D$7:$D$500="Offender
Missed Call (STaR)"))]
Sheets("Summary").Cells(i, "I").Value = numberOfViolations
Next i
End Sub
----------------------------------------------

when compiling it is not giving me any errors, its just simply doesnt
work
gives me #value! as i said before.

PS! what i am trying to do is to count how many entries in detail meet
that criteria from formula, first critera will be alway different and
it will be taken from A7, A8, A9, thats why i dont have a specific name
there and i used $A$"&i&" as one guy suggested from my previous post,
please really need help, thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro wtih sumproduct 2 help

Back to my original post,

Well, there was a typo in that a paren was left off the end (to close the
evaluate function). However, after I fixed that it worked fine.

Sub abc()
For i = 7 To 10
cnt = Evaluate("SUMPRODUCT((Detail!$D$7:$D$500" & _
"=""Offender Missed Call(STaR)"")*(Detail!$B$7:$B$500=Summary!$A$" & _
i & "))")
Worksheets("Summary").Cells(i, "I").Value = cnt

Next i

End Sub



Tested successfully.
--
Regards,
Tom Ogilvy


wrote in message
ups.com...
hello, i though my problem was solved by it is not
i am not able to make my function to work, it is govong me #value! for
a result

here is my sub
-------------------------------------------------------
Sub test()

Dim numberOfViolations As Variant 'if i will declare this as long
getting type mismatch

For i = 7 To 500

If Sheets("Summary").Cells(i, "A").Value = "" Then
Exit Sub
End If
numberOfViolations =
[SUMproduct((Detail!$B$7:$B$500=$A$"&i&")*(Detail!$ D$7:$D$500="Offender
Missed Call (STaR)"))]
Sheets("Summary").Cells(i, "I").Value = numberOfViolations
Next i
End Sub
----------------------------------------------

when compiling it is not giving me any errors, its just simply doesnt
work
gives me #value! as i said before.

PS! what i am trying to do is to count how many entries in detail meet
that criteria from formula, first critera will be alway different and
it will be taken from A7, A8, A9, thats why i dont have a specific name
there and i used $A$"&i&" as one guy suggested from my previous post,
please really need help, thanks



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
macro with SUMPRODUCT help [email protected] Excel Programming 8 August 30th 06 10:27 PM
How to use SUMPRODUCT in macro? Tarek Excel Programming 6 April 27th 05 07:03 AM
Help wtih date and time in the same cell Michaela Excel Worksheet Functions 3 February 9th 05 09:49 PM
Help needed wtih Vlookup farmer[_2_] Excel Programming 2 May 13th 04 08:52 PM
How do I use Excel9.olb with computers wtih Excel 97? Tom Ogilvy Excel Programming 0 August 29th 03 01:30 AM


All times are GMT +1. The time now is 04:21 PM.

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"