View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default SumProduct with more than 1 selection

TW,

In SUMPRODUCT formulas, you can use + as an analog to OR:

Your idea:

=SUMPRODUCT(--(Zmth=B2),--(Zbuscode=18),--(Zinvest="A"),--(Zinvest="B"),--(Zinvest="C"),Zamt)

Could also be

=SUMPRODUCT(--(Zmth=B2),--(Zbuscode=18),((Zinvest="A")+(Zinvest="B")+(Zinves t="C")),Zamt)

Just an alternative to the array version, and one which I find easier to remember....

HTH,
Bernie
MS Excel MVP


wrote in message
ups.com...
Hi all,
I am using the following formular which works fine.

The Z... are named ranges of columns.

=SUMPRODUCT(--(Zmth="APR"),--(Zbuscode=18),--(Zinvest="A"),Zamt)

But If I want to select a number of additional selections to Zinvest in
the same column
e.g. A, B, C
I seem to be getting a problem.


Tried this which resulted in Zero.

=SUMPRODUCT(--(Zmth=B2),--(Zbuscode=18),--(Zinvest="A"),--(Zinvest="B"),--(Zinvest="C"),Zamt)


Also tried this which resulted in #VALUE

=SUMPRODUCT(--(Zmth=B2),--(Zbuscode=18),--OR(--(Zinvest="A"),--(Zinvest="B"),--(Zinvest="C")),Zamt)


Any Suggestions?
Many Thanks
TW