View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Conan Kelly Conan Kelly is offline
external usenet poster
 
Posts: 419
Default Sum with multiple criteria using SUMPRODUCT

Using XL 2003 SP3 on Win XP Pro SP2

--
Hello all,

I have the following formula:

=SUMPRODUCT((Sheet1!$A$2:$A$101=ChartHome)*(Sheet1 !$C$2:$C$101=LEFT($B107,2))*(Sheet1!G$2:G$101))

What I want to do is eliminate the first condition
("(Sheet1!$A$2:$A$101=ChartHome)") depending on the value of ChartHome. I
tried the following, but XL didn't like using an IF function inside a
SUMPRODUCT function:

=SUMPRODUCT(IF(ChartHome=16,1,(Sheet1!$A$2:$A$101= ChartHome))*(Sheet1!$C$2:$C$101=LEFT($B107,2))*(Sh eet1!G$2:G$101))

I'm guessing that it has something to do with the fact that SUMPRODUCT is an
array function and IF is not. I thought non-array functions would be
converted to array functions when used inside an array function. Guess
not!!!

I know I can accomplish this by having the IF fuction outside and 2
different SUMPRODUCT's inside. I just thought there might be a more
streamlined way of doing it like my example above (IF inside a SUMPRODUCT)

Can anyone think of a more streamlined way other than 2 SUMPRODUCT's inside
an IF?

Thanks for any help anyone can provide,

Conan Kelly