Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Using a wild card in SUMPRODUCT

I'm using the following formula:

=SUMPRODUCT(--(D6:D1000="*/2-2 IN"),--(E6:E1000'="NBI"))

which returns a value of "0". The "*" could be an A, B, C, D, HHC, or E.

If I replace the * with one of the letters, I get a correct value. How can I
use the wildcard returning a correct value for all the true conditions of
A/2-2, B/2-2, C/2-2, D/2-2, E/2-2, and HHC/2-2?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Using a wild card in SUMPRODUCT

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"))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"SFC Traver" wrote:

I'm using the following formula:

=SUMPRODUCT(--(D6:D1000="*/2-2 IN"),--(E6:E1000'="NBI"))

which returns a value of "0". The "*" could be an A, B, C, D, HHC, or E.

If I replace the * with one of the letters, I get a correct value. How can I
use the wildcard returning a correct value for all the true conditions of
A/2-2, B/2-2, C/2-2, D/2-2, E/2-2, and HHC/2-2?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Using a wild card in SUMPRODUCT

Try this:

=SUMPRODUCT(--(ISNUMBER(SEARCH("/2-2 IN",D6:D1000))),--(E6:E1000="NBI"))

Better to use cells to hold the criteria:

D1 = /2-2 IN
E1 = NBI

=SUMPRODUCT(--(ISNUMBER(SEARCH(D1,D6:D1000))),--(E6:E1000=E1))

--
Biff
Microsoft Excel MVP


"SFC Traver" wrote in message
...
I'm using the following formula:

=SUMPRODUCT(--(D6:D1000="*/2-2 IN"),--(E6:E1000'="NBI"))

which returns a value of "0". The "*" could be an A, B, C, D, HHC, or E.

If I replace the * with one of the letters, I get a correct value. How can
I
use the wildcard returning a correct value for all the true conditions of
A/2-2, B/2-2, C/2-2, D/2-2, E/2-2, and HHC/2-2?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Using a wild card in SUMPRODUCT

Thanks, Shane. Works great. I was just hoping there was a less time consuming
way to do it. I even tried using the RIGHT function to no avail. But at least
your solution works!

"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"))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"SFC Traver" wrote:

I'm using the following formula:

=SUMPRODUCT(--(D6:D1000="*/2-2 IN"),--(E6:E1000'="NBI"))

which returns a value of "0". The "*" could be an A, B, C, D, HHC, or E.

If I replace the * with one of the letters, I get a correct value. How can I
use the wildcard returning a correct value for all the true conditions of
A/2-2, B/2-2, C/2-2, D/2-2, E/2-2, and HHC/2-2?

Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 82
Default Using a wild card in SUMPRODUCT

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.


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Using a wild card in SUMPRODUCT

No. It's not needed.

Since a cell can only meet one *or* the other conditions the resulting array
will only return a 1 or 0 so a test for 0 is superfluous.

--
Biff
Microsoft Excel MVP


"Rasoul Khoshravan" wrote in message
...
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.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Using a wild card in SUMPRODUCT

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
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Using a wild card in SUMPRODUCT

Try this:

=SUMPRODUCT((RIGHT(D6:D1000,7)="/2-2 IN")*(E6:E1000="NBI"))


"SFC Traver" wrote:

I'm using the following formula:

=SUMPRODUCT(--(D6:D1000="*/2-2 IN"),--(E6:E1000'="NBI"))

which returns a value of "0". The "*" could be an A, B, C, D, HHC, or E.

If I replace the * with one of the letters, I get a correct value. How can I
use the wildcard returning a correct value for all the true conditions of
A/2-2, B/2-2, C/2-2, D/2-2, E/2-2, and HHC/2-2?

Thanks!

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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



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
how do I use wild card in SUMPRODUCT formula? Foad Excel Worksheet Functions 4 October 21st 08 07:50 AM
wild card in sumproduct BNT1 via OfficeKB.com Excel Worksheet Functions 3 November 26th 07 04:10 AM
sumproduct with a search and wild card Scorpvin Excel Discussion (Misc queries) 1 June 14th 06 04:46 PM
Wild Card Search roy.okinawa Excel Worksheet Functions 4 January 30th 06 10:42 PM
Wild card * Herman Excel Worksheet Functions 0 October 21st 05 01:39 PM


All times are GMT +1. The time now is 11:30 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"