Test if contains a string in a list

books4cars

Board Regular
Joined
Apr 12, 2007
Messages
200
Hi,

I have the following in D2 which contains "David & Rose Smith

=iferror(LEFT($C2,(FIND(" ",$C2,1)-1)),C2)

I want to test for strings listed in the named range, "NOGOOD".

If none of the string are in C2, I'd like to apply above. If any of the stings in NOGOOD appear in C2, the result should be blank.

I believe I'm simply having trouble nesting this correctly:



=if(SUMPRODUCT(COUNTIF(rng,"*"&substrings&"*"))>0,(LEFT($C2,(FIND(" ",$C2,1)-1)),C2),"")

Thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
How about
=IF(SUMPRODUCT(COUNTIF(C2,"*"&G2:G5&"*"))=0,IFERROR(LEFT($C2,(FIND(" ",$C2,1)-1)),C2),"")

Where the NoGood strings are in G2:G5
 
Upvote 0
Perfect! Thank you!
Are you sure?

If C2 contains "David & Rose Williamson" and NOGOOD contains "Jones" and "Williams" then that formula returns blank even though none of the names in NOGOOD appear in C2.

If I am right in what you are trying to achieve, then try this test for the existence of the names. You can replace the Found/Not found with what you want. This is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}

Excel Workbook
CDEF
1Jones
2David & Rose WilliamsonNot foundWilliams
Check List
#VALUE!
</td></tr></table></td></tr></table>
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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