Sumproduct with a text string

Iknewthisguy

Active Member
Joined
Jan 22, 2009
Messages
274
Evening,

I'm trying to count the occurrences of a name (i.e. Chris) in column A that have the occurrence of a color (i.e. red) in column B. The problem is in column B I have varying rows of text strings that all contain a color but never in the same place. What I've been trying to do is =sumproduct((A1:A100="Chris")*(B1:B100="red")) but it's not working. I believe it's not working because it's not searching the text string.

Any help would be appreciated.

Thanks.
Chris
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Not sure but I think you need a COUNTIF().
If your trying to Find "Chris" in red then I am not sure any Formulas search for formatting.

Can you post a screenshot?

You could most probably acheive this with a VBA function.
 
Upvote 0
Give this formula a try...

=SUMPRODUCT(ISNUMBER(SEARCH("*chris*",A1:A100))*ISNUMBER(SEARCH("*red*",B1:B100)))
 
Upvote 0
Rick,
No real need for wildcards there, is there? Or am I missing something?
 
Upvote 0
Rick,
No real need for wildcards there, is there? Or am I missing something?
@Rory - Nope, no need for the wildcards at all... I just got carried away there.:eek:

@Chris - Here is the formula Rory is indicating I should have posted...

=SUMPRODUCT(ISNUMBER(SEARCH("chris",A1:A100))*ISNUMBER(SEARCH("red",B1:B100)))
 
Upvote 0
No biggie - just curious. It works either way, and yours is a good reminder that you can use wildcards to pattern match with SEARCH. :)
 
Upvote 0
How come ISNUMBER() returns a numeric value, but in the formula it will return the text?

Sorry yes I see now it returns the parameters for the SUMPRODUCT() function.

cheers
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top