Check If a Cell Includes List of Partial Values

L

Legacy 143009

Guest
Hello,

Usually, there are many methods to match the partial text in a range but I need just the opposite.
I have list of partial values and I want to check if a specific cell value includes any of those partial strings.

Thanks for the help!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Like this?

Book1
ABCD
1textpartial text
2I like dogTRUEdog
3I hate lionFALSEcat
4Catwalk in the nightFALSEelephant
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=OR(ISNUMBER(SEARCH(" " & $D$2:$D$4 & " "," " & A2 & " ")))
 
Upvote 1
Its simpler.
Code:
=OR(ISNUMBER(SEARCH($D$2:$D$4,A2)))
Book1
ABCD
1textpartial text
2I like dogTRUEdog
3I hate lionFALSEcat
4Catwalk in the nightFALSEelephant
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=OR(ISNUMBER(SEARCH($D$2:$D$4,A2)))
B4 should return true since it includes one of the partial strings "cat".
 
Upvote 1
What version of office do you have? And do you want VBA or formulas?

Like this (column A contains substrings. Column B contains the full strings that we need to check to see if they contain any of the substrings in column A)?
a.xlsb
ABC
1abab39cfyes
2cdcfno
3efno
Sheet9
Cell Formulas
RangeFormula
C1:C3C1=IF(SUM(IFERROR(FIND($A$1:$A$3,B1),0))>0,"yes","no")
 
Upvote 0
Like this?

Book1
ABCD
1textpartial text
2I like dogTRUEdog
3I hate lionFALSEcat
4Catwalk in the nightFALSEelephant
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=OR(ISNUMBER(SEARCH(" " & $D$2:$D$4 & " "," " & A2 & " ")))
No.. Not really. Actually Catwalk includes one of the strings in the range.
 
Upvote 0
No.. Not really. Actually Catwalk includes one of the strings in the range.
Its simpler.
Code:
=OR(ISNUMBER(SEARCH($D$2:$D$4,A2)))
Book1
ABCD
1textpartial text
2I like dogTRUEdog
3I hate lionFALSEcat
4Catwalk in the nightFALSEelephant
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=OR(ISNUMBER(SEARCH($D$2:$D$4,A2)))
 
Upvote 0
What version of office do you have? And do you want VBA or formulas?

Like this (column A contains substrings. Column B contains the full strings that we need to check to see if they contain any of the substrings in column A)?
a.xlsb
ABC
1abab39cfyes
2cdcfno
3efno
Sheet9
Cell Formulas
RangeFormula
C1:C3C1=IF(SUM(IFERROR(FIND($A$1:$A$3,B1),0))>0,"yes","no")
I was not able to check all rows but at the first glance, I think this works. Thanks a lot!
 
Upvote 0
If you have Office 365, then you can use this formula instead, where you don't have to carry down the formula (or manually define the range containing the substring or the range containing the text. You just would need to change all 3 occurrences of A:A to G:G, if the substrings were in column G instead of A. Same for B:B.):
a.xlsb
ABC
1abab39cfyes
2cdcfno
3efbefdyes
4ghghyes
5ab39cfyes
6cdyes
7dano
8catno
9beefyes
10aboutyes
11effortyes
12
Sheet9
Cell Formulas
RangeFormula
C1:C11C1=LET( rowsInA,MAX(IF(A:A<>"",ROW(A:A),0)), rowsInB,MAX(IF(B:B<>"",ROW(B:B),0)), colA,INDEX(A:A,SEQUENCE(rowsInA)), colB,INDEX(B:B,SEQUENCE(rowsInB)), IF(TRANSPOSE(MMULT(TRANSPOSE(0*SEQUENCE(rowsInA))+1,IFERROR(FIND(colA,TRANSPOSE(colB)),0)))>0,"yes","no") )
Dynamic array formulas.
 
Last edited:
Upvote 0
@Flashbond
As has already been asked, please update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Another option might be ..

22 09 29.xlsm
ABC
1abab39cfTRUE
2cdcfFALSE
3ef
Check substrings
Cell Formulas
RangeFormula
C1:C2C1=COUNT(FIND(A$1:A$3,B1))>0
 
Upvote 0
For what it's worth, I shortened the formula from my previous post a little, assigned two more LET variables (so that you only have to replace A:A and B:B once), and renamed all LET variables to something more meaningful. (But this assumes that the cells in the two columns are all non-blank starting with the cells in row 1 and up to whatever row they each end on.)
a.xlsb
ABC
1abab39cfyes
2cdcfno
3efbefdyes
4ghghyes
5ab39cfyes
6cdyes
7dano
8catno
9reefyes
10aboutyes
11effortyes
12
Sheet9
Cell Formulas
RangeFormula
C1:C11C1=LET( substrFullCol,A:A, textFullCol,B:B, substrColRows,MAX(IF(substrFullCol<>"",ROW(substrFullCol),0)), textColRows,MAX(IF(textFullCol<>"",ROW(textFullCol),0)), substrCol,INDEX(substrFullCol,SEQUENCE(substrColRows)), textCol,INDEX(textFullCol,SEQUENCE(,textColRows)), IF(TRANSPOSE(MMULT(0*SEQUENCE(,substrColRows)+1,IFERROR(FIND(substrCol,textCol),0)))>0,"yes","no") )
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,216,128
Messages
6,129,033
Members
449,482
Latest member
al mugheen

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