View Single Post
  #10   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,

I guess I's still doing something wrong. I am now getting Type mismatch
errors. Is it possible to get a soft copy of your test file or for me to
send a soft copy of mine ? Or can I send snaphot of debuggeer output ?

I'm not sure what to do next.

Thanks for your patience,

Gary

"Bob Phillips" wrote:

Okay, what you need then is

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

I tested with both as text :-(

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"gary" wrote in message
...
Hio Bob,

ItemEmp is text string and ItemColor is numeric. Columns M and N are the
numeric columns that I want to sum for the qualifing name and color.

Gary

"Bob Phillips" wrote:

Gary,

Are ItemEmp and ItemColor text or numeric variables?

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"gary" wrote in message
...
Hi Bob,

I guess I'm getting closer. The 2015 error is gone, but now I always

get
a
total = 0 which isn't the correct sum.

I'm wondering if the three quotes are waht I really need.

I hope you have another idea.

Thanks,

Gary

"Bob Phillips" wrote:

Hi Gary,

Sorry I didn't spot that there were two columns being added. In that
instance, the -- doesn't work, you need *


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
...
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