View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary Gary is offline
external usenet poster
 
Posts: 273
Default VBA - Problem with compound SUMIF function

Bob,

When I try this I get "error = 2015"

Any ideas ?


"Bob Phillips" wrote:

Total = ActiveSheet.Evaluate("SUMPRODUCT(--(L4:L500=""" & ItemEmp & """)" &
_
"--(D4:D500=""" & ItemColor & """),M4:N500)")


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"gary" wrote in message
...
I am trying to select criteria from two columns and then do a sum on two
other columns. The first SUMIF works fine (with any single criteria) but

I
am unable to add the second criteria. When I try, I get a "type mismatch"
error.

This works:
Total = SUMIF (Application.SUMIF (Range ("L4:L500)", ItemEmp, Range
("M4:N500"))

This does not work:

Total = SUMIF (Application.SUMIF ( (Range ("L4:L500") =ItemEmp) * (Range
("D4:D500") =ItemColor), Range ("M4:N500"))

Thanks,

gary