SUMPRODUCT with "Contains"

WildWill

Board Regular
Joined
Sep 10, 2009
Messages
92
I am using this formula: =SUMPRODUCT(('Staffing Data'!E8:E9082=S3)*('Staffing Data'!P8:P9082='Staffing Report'!O6)*('Staffing Data'!AA8:AA9082="Active")).

I want to change the last component (AA8:AA9082="Active") to find any cell which contains the word "Active" but could contain other text characters. How do I change the syntax for this?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Not sure what you are trying to do here - if you want to count all the matches of rows where teh values are S3 O6 and include "Active" in the last criteria than this should do it :

=SUMPRODUCT(--('Staffing Data'!E8:E9082=S3),--('Staffing Data'!P8:P9082='Staffing Report'!O6),--(isnumber(find("Active",'Staffing Data'!AA8:AA9082)))

FIND is case sensitive - SEARCH isnt so would include inactive or active as a match when FIND would not; both would match with Active yoghurt or Activeman. Search can also include wild cards ? and * if that helps any (? means any single character and * means any one or more character). Both return an error (#VALUE) if they cant find the search string hence ISNUMBER returns FALSE
 
Upvote 0
You can also replace your third component with:

countif('Staffing Data'!AA8:AA9082,"*Active*")

This will count any occurrence of Active or active in any cell in the AA8 through AA9802 range.
 
Upvote 0
Thanks Guys!!! both comments highly appreciated. One more related question: how do I structure SUMPRODUCT syntax to combine AND as well as OR functions: E.g If I want a SUMPRODUCT to count all cells where A1:A10="Blue", B1:B10="X" and C1:C10="B" or "C"...how would I achieve this?
 
Upvote 0
If you only have one OR condition:
=SUMPRODUCT((A1:A10="Blue")*(B1:B10="X")*(C1:C10={"B","C"}))

or you can use:
=SUMPRODUCT((A1:A10="Blue")*(B1:B10="X")*((C1:C10="B")+(C1:C10="C")))
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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