Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Sumproduct Multiple < Conditions

So, normally I would use this format for my conditional formulas:

=SUMPRODUCT(--((X2:X500="foo")+(X2:X500="oof")0),--(Y2:Y500<100),(Z2:Z500))

Which gets me the sum of column Z, if column Y is less than 100, and column X
is "foo" OR "oof"

I'm keep hitting a problem, though, with one type of conditional . . . what
if I want every thing that is NEITHER "foo" NOR "oof" ?

=SUMPRODUCT(--((X2:X500<"foo")+(X2:X500<"oof")0),--(Y2:Y500<100),(Z2:Z500))


is wrong . . . because it's telling it NOT "foo" OR NOT "oof" . . .

thank you for any help.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Sumproduct Multiple < Conditions

How about:

=SUMPRODUCT(--(X2:X500<"foo"),--(X2:X500<"oof"),--(Y2:Y500<100),(Z2:Z500))

And I'd be careful with your original formula. I think you're missing a pair of
()'s.

=SUMPRODUCT(--((X2:X500="foo")+(X2:X500="oof")0),--(Y2:Y500<100),(Z2:Z500))
should be:
=SUMPRODUCT(--(((X2:X500="foo")+(X2:X500="oof"))0),--(Y2:Y500<100),(Z2:Z500))

(foo+oof)0, right?


"undrline via OfficeKB.com" wrote:

So, normally I would use this format for my conditional formulas:

=SUMPRODUCT(--((X2:X500="foo")+(X2:X500="oof")0),--(Y2:Y500<100),(Z2:Z500))

Which gets me the sum of column Z, if column Y is less than 100, and column X
is "foo" OR "oof"

I'm keep hitting a problem, though, with one type of conditional . . . what
if I want every thing that is NEITHER "foo" NOR "oof" ?

=SUMPRODUCT(--((X2:X500<"foo")+(X2:X500<"oof")0),--(Y2:Y500<100),(Z2:Z500))

is wrong . . . because it's telling it NOT "foo" OR NOT "oof" . . .

thank you for any help.

--
Message posted via http://www.officekb.com


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Sumproduct Multiple < Conditions

Try this:

=SUMPRODUCT((X2:X500<"foo")*(X2:X500<"oof")*(Y2: Y500<100)*(Z2:Z500))


"undrline via OfficeKB.com" wrote:

So, normally I would use this format for my conditional formulas:

=SUMPRODUCT(--((X2:X500="foo")+(X2:X500="oof")0),--(Y2:Y500<100),(Z2:Z500))

Which gets me the sum of column Z, if column Y is less than 100, and column X
is "foo" OR "oof"

I'm keep hitting a problem, though, with one type of conditional . . . what
if I want every thing that is NEITHER "foo" NOR "oof" ?

=SUMPRODUCT(--((X2:X500<"foo")+(X2:X500<"oof")0),--(Y2:Y500<100),(Z2:Z500))


is wrong . . . because it's telling it NOT "foo" OR NOT "oof" . . .

thank you for any help.

--
Message posted via http://www.officekb.com


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Sumproduct Multiple < Conditions

Hmm, normally pointing to two conditions in the same column is bad . . . but
maybe the < changes it . . . I think I found a different solution, though.

About the 0 . . . it's what I was told to do in this thread:
http://www.officekb.com/Uwe/Forum.as...tes-like-Sumif


Here's why the 0 doesn't make sense to me, and the formula seems to always
work without it at all:
My understanding is that an array is turned into a set of ones-and-zeros,
representing true or false, which are then multiplied against the
corresponding rows in the other arrays . . . if any zeros appear, then the
whole thing is zero, and only if every array is one, for that same row, will
they stay one. If one was not a conditional array with a "--" then one
multiplied by that number is that number. Then, the new (resulting) array is
totalled, either giving a count if all were conditional arrays, or a sum, if
it had that one non-conditional. So, in order to have two options from one
column, it might confuse the function as to what row it's testing in the
arrays: so the thought is that one cell would not hold two separate values.
It would be one or the other. Therefore, one of the multiple conditions
("foo" or "oof") has to be false for that cell, or zero. So, the sum of the
two conditions should be 0+1, 0+0, or 1+0. I don't see any way that you
would ever have a negative number. Maybe empty cells? But empty cells are
an empty string value in Excel by default, and would still evaluate to true
or false. Of the three options, there is one that would throws a fit when
you wrap parenthesis around the whole thing . . . (0+0)0 . . . you're
evaluating falsefalse, and it doesn't want to evaluate to false. Every time
I've tried it, it doesn't seem to work.


Dave Peterson wrote:
How about:

=SUMPRODUCT(--(X2:X500<"foo"),--(X2:X500<"oof"),--(Y2:Y500<100),(Z2:Z500))

And I'd be careful with your original formula. I think you're missing a pair of
()'s.

=SUMPRODUCT(--((X2:X500="foo")+(X2:X500="oof")0),--(Y2:Y500<100),(Z2:Z500))
should be:
=SUMPRODUCT(--(((X2:X500="foo")+(X2:X500="oof"))0),--(Y2:Y500<100),(Z2:Z500))

(foo+oof)0, right?

So, normally I would use this format for my conditional formulas:

[quoted text clipped - 14 lines]
--
Message posted via http://www.officekb.com



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200703/1

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Sumproduct Multiple < Conditions

I really prefer the double unary operator, mostly because it makes it easier
to read, and discern conditions from sums. But using * as AND, and + as OR
makes sense:

I think this would work:
=SUMPRODUCT(--((X2:X500<"foo")*(X2:X500<"oof")),--(Y2:Y500<100),(Z2:Z500))

Thanks.

Thank you both for helping out.




Teethless mama wrote:
Try this:

=SUMPRODUCT((X2:X500<"foo")*(X2:X500<"oof")*(Y2 :Y500<100)*(Z2:Z500))

So, normally I would use this format for my conditional formulas:

[quoted text clipped - 11 lines]

thank you for any help.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200703/1

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT with conditions sahafi Excel Worksheet Functions 3 November 30th 06 10:32 PM
Conditions in sumproduct Antonio Excel Worksheet Functions 3 October 26th 06 03:18 AM
sumproduct three conditions Scire Excel Worksheet Functions 3 May 9th 06 06:22 PM
Multiple SumProduct conditions wal50 Excel Worksheet Functions 3 November 23rd 04 10:48 PM
Sumproduct Multiple Conditions Tysone Excel Worksheet Functions 3 November 10th 04 03:03 PM


All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"