Thread: SUMIF HELP
View Single Post
  #5   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

=SUMPRODUCT((A3:A44={"M","W"})*K3:K44)

is not efficient though.

In cases of 2 conditions to or, one can get away with the + idiom:

[1]

=SUMPRODUCT((A3:A44="M")+(A3:A44="W"),K3:K44)

as Max suggested.

The following invokes an efficient idiom for or'ing...

[2]

=SUMPRODUCT(--ISNUMBER(MATCH(A3:A44,{"M","W"},0)),K3:K44)

An equivalent setup with SumIf is...

[3]

=SUMPRODUCT(SUMIF(A3:A44,{"M","W"},K3:K44))

where Sum can be sustituted for SumProduct when a constant array of
conditions is used (as occurs in your other reply).

To recap, with J1:J2 housing the conditions "M" and "W"...

[1] SUMPRODUCT((A3:A44=J1)+(A3:A44=J2),K3:K44)
[2] SUMPRODUCT(--ISNUMBER(MATCH(A3:A44,J1:J2,0)),K3:K44)
[3] SUMPRODUCT(SUMIF(A3:A44,J1:J2,K3:K44))

The first one becomes unwieldy with more conditions. It would be
interesting to compare temporal profiles of the second and the third though.







Jason Morin wrote:
I think Bob meant this:

=SUMPRODUCT((A3:A44={"M","W"})*K3:K44)

Jason


-----Original Message-----
"Bob Phillips" wrote

=SUMPRODUCT(--(A3:A44={"M","W"}),K3:K44)


Tried this, Bob, but think it returns #VALUE!

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


.