View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Using a wild card in SUMPRODUCT

=SUMPRODUCT(--((D6:D1000="A/2-2 IN")+(E6:E1000="something else")+....

Yes, you would need it when testing different arrays for an "or" condition.
The OP is testing the same array for the "or" condition.

For the OP, here's how it works...

Let's assume you want to test A1 to see if it contains either an A or a B.

A1 can contain only one or the other, it can't can't contain both!

Let's assume A1 = A

(A1="A")+(A1="B")

(A1="A") = TRUE
(A1="B") = FALSE

TRUE + FALSE = 1

Now, let's assume A1 = B

(A1="A") = FALSE
(A1="B") = TRUE

FALSE + TRUE = 1

The result of the test can only be 1 or 0. So, in this case, testing for 0

--((A1="A")+(A1="B")0)

Is redundant since it will return the exact same result.

(A1="A")+(A1="B") = 1
--((A1="A")+(A1="B")0) = 1

Now, if you're testing different arrays for an "or" condition...

A1 or B1 = A

Let's assume both A1 and B1 = A

(A1="A")+(B1="A")

A1 = "A" = TRUE
B1 = "A" = TRUE

TRUE + TRUE = 2

Since this is an "or" condition you don't want the result to be counted
twice and that's where the test for 0 comes into play.

--((A1="A")+(B1="A")0) = 1

Hopefully, that will shed some light on it.


--
Biff
Microsoft Excel MVP


"Dave Peterson" wrote in message
...
But it gives me a feeling of safety.

If I gave that formula to someone who decided to include an additional
"or"
check in a different column, I'd want that "0" there.

=SUMPRODUCT(--((D6:D1000="A/2-2 IN")+(E6:E1000="something else")+....



Rasoul Khoshravan wrote:

On Feb 16, 8:04 am, Shane Devenshire
wrote:
Hi,

The SUMPRODUCT function does not support wildcards. Second problem is
that
*anything will return anything.

You could use something like this

=SUMPRODUCT(--((D6:D1000="A/2-2 IN")+(D6:D1000="B/2-2
IN")+(D6:D1000="C/2-2
IN")+(D6:D1000="D/2-2 IN")+(D6:D1000="E/2-2 IN")+(D6:D1000="HHC/2-2
IN")0),--(E6:E1000="NBI"))


Is there a reason to put 0. Traver's original question doesn't have
this criteria.


--

Dave Peterson