View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
BOSS BOSS is offline
external usenet poster
 
Posts: 123
Default Sum col with reference to criteria in other col

Thanks for the reply but as i said i caanot use sumproduct because i have
many criteria to sum for.
i have database of 250 rows where scores of 70 emp is filled. I have to pull
the total score of each employee in a different sheet.
i need to find the total score of each emp..

Hope thsi makes issue clear.. please help..

Thanks a lot..
Boss
"Gary Keramidas" wrote:

with data in a1:b8

excel formulas
=SUMPRODUCT((A1:A8="yes")*(B1:B8))
=SUMIF(A1:A8,"=yes",B1:B8)


in vb, if you just want the values

range("e3").Value = application.Evaluate("SUMPRODUCT((A1:A8=" & """yes""" &
")*(B1:B8))")
range("f3").Value = application.Evaluate("SUMIF(A1:A8," & """=yes""" &
",B1:B8)")
--


Gary


"Boss" wrote in message
...
I have foll data

criteria score Unique answer
yes 4 yes 20
yes 6 no 116
yes 6
yes 4
no 45
no 57
no 6
no 8

I need is sum of all the score for each criteria

Yes would give 20
No would give 116

I tried the foll...

Range("b3").Value = Application.WorksheetFunction.SumIf(Range("a:a"),
Range("c2"), Range("b:b"))

Problem is the criteria "c2", i wish to change using a loop. i cannot use
sumproduct because the criteria are more in number close to 50.

Thsi something very imp for me and i am badly stuck.. please help..

Thanks!
Boss