Search & Find String of Words

flds

Board Regular
Joined
Jun 19, 2008
Messages
78
Office Version
  1. 2021
Platform
  1. Windows
Hello,
I am looking to create a formula.
My requirement is, I have over 1200 rows of data and filling up. I am trying to match text. I have text in column A & B. I need the same string of words contained in Col 'B', to match in Col 'A'. (String of words in Col 'A' could be long in some rows). Return "Yes" or "No" in Col 'C', on same row as match found in Col 'A'.
Hope I am clear in my requirement.

I googled and tried these formulas, and failed

"IFERROR(IF(MATCHif("*"&B1&"*",A:A,0),"yes",),"no")"

"IF(COUNTIF(A:A, "*"&$B$1&"*"), "Yes", "")"

Your help would be greatly appreciated. Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Some sample data and which Excel version you're using would be helpful.
 
Upvote 0
In C1. ARRAY formula needsCtrl+Shift+Enter. Not simple entry.
Excel Formula:
=IF(B1="","",IF(SUM(1*(ISNUMBER(FIND(B1,$A$2:$A$4)))),"YES","NO"))
 
Upvote 0
Hello Cubist,
Thanks for your quick response, much appreciate.
I am using Excel Version 2021. To send you data sample I will have to learn how to do that.

It's very simple,
In column 'A' I have long sentences or paragraph in them are embedded the names of staff with their first name and last name, some with first, middle and last names.
I need to search these staff names from column 'B', find on which row in column 'A' they are in.
In Column 'C' with a help of a formula return a 'Yes' on the row the name is found.
Once found I sort column 'C' with 'Yes' and create a report.
I hope this is clear. Let me know if you still need a data sample.
Thanks
 
Upvote 0
See if this works for you (without the need of the helper column C).
Book1
ABCD
1NamesSearch NameReport
2John Michael SmithJohnJohn Michael Smith
3Smith, John MichaelSmith, John Michael
4Emily Rose CarterDavid L. Johnson
5Carter, Emily RoseJohnson, David L.
6David L. Johnson
7Johnson, David L.
8Sophia Anne Thompson
9Thompson, Sophia Anne
10James O'Connor
11O'Connor, James
12Robert K. Williams
13Williams, Robert K.
14Anna-Marie Lee
15Lee, Anna-Marie
16Benjamin G. Martinez
17Martinez, Benjamin G.
18Victoria F. Cruz
19Cruz, Victoria F.
20Nathaniel Jameson Brown
21Brown, Nathaniel Jameson
22Olivia Hope Grant
23Grant, Olivia Hope
Sheet5
Cell Formulas
RangeFormula
D2:D5D2=FILTER(A2:A23,ISNUMBER(SEARCH(B2,A2:A23)),"")
Dynamic array formulas.
 
Last edited:
Upvote 0
In C1. ARRAY formula needsCtrl+Shift+Enter. Not simple entry.
Excel Formula:
=IF(B1="","",IF(SUM(1*(ISNUMBER(FIND(B1,$A$2:$A$4)))),"YES","NO"))
Thanks kvsrinivasamurthy, for your response and formula.
It looks like the formula works also without Ctrl+Shift+Enter. This is not what I am looking for. I would appreciate if you could modify the formula as I have described below.

In Column 'C', I am looking for the 'Yes' to return on the same row on which the content of 'B' is found in column.'A'.
I hope this makes sense of my requirement.
Thanks
 
Upvote 0
I am using Excel Version 2021
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’)

See if one of these does what you want, noting especially row 16. Your initial description talked about "words" but your attempted formulas would have found "strings" not necessarily "words" so I'm not quite sure what you are after. (All the more reason for providing sample data and results as requested by @Cubist ;) )
To provide sample data (& expected results) I suggest that you investigate XL2BB.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)

Try these in row 2 (don't copy down the columns)
Adjust the column A range for your larger data.

The "word match" formula may not be very reliable if the column A data contains punctuation. If that is the case and you need more help, then varied sample data and the corresponding results become even more useful. :)

24 11 20.xlsm
ABCD
1NamesJohnText matchWord match
2John Michael SmithYesYes
3Smith, John MichaelYesYes
4Emily Rose CarterNoNo
5Carter, Emily RoseNoNo
6David L. JohnsonYesNo
7Johnson, David L.YesNo
8NoNo
9Thompson, Sophia AnneNoNo
10James O'ConnorNoNo
11O'Connor, JamesNoNo
12Robert K. WilliamsNoNo
13NoNo
14NoNo
15NoNo
16Tom MicheljohnYesNo
17Martinez, Benjamin G.NoNo
18Victoria F. CruzNoNo
19Cruz, Victoria F.NoNo
20Nathaniel Jameson BrownNoNo
21Brown, Nathaniel JamesonNoNo
22Olivia Hope GrantNoNo
23Grant, Olivia HopeNoNo
Match text
Cell Formulas
RangeFormula
C2:C23C2=IF(ISNUMBER(SEARCH(B1,A2:A23)),"Yes","No")
D2:D23D2=IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No")
Dynamic array formulas.
 
Last edited:
Upvote 0
Solution
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’)

See if one of these does what you want, noting especially row 16. Your initial description talked about "words" but your attempted formulas would have found "strings" not necessarily "words" so I'm not quite sure what you are after. (All the more reason for providing sample data and results as requested by @Cubist ;) )
To provide sample data (& expected results) I suggest that you investigate XL2BB.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)

Try these in row 2 (don't copy down the columns)
Adjust the column A range for your larger data.

The "word match" formula may not be very reliable if the column A data contains punctuation. If that is the case and you need more help, then varied sample data and the corresponding results become even more useful. :)

24 11 20.xlsm
ABCD
1NamesJohnText matchWord match
2John Michael SmithYesYes
3Smith, John MichaelYesYes
4Emily Rose CarterNoNo
5Carter, Emily RoseNoNo
6David L. JohnsonYesNo
7Johnson, David L.YesNo
8NoNo
9Thompson, Sophia AnneNoNo
10James O'ConnorNoNo
11O'Connor, JamesNoNo
12Robert K. WilliamsNoNo
13NoNo
14NoNo
15NoNo
16Tom MicheljohnYesNo
17Martinez, Benjamin G.NoNo
18Victoria F. CruzNoNo
19Cruz, Victoria F.NoNo
20Nathaniel Jameson BrownNoNo
21Brown, Nathaniel JamesonNoNo
22Olivia Hope GrantNoNo
23Grant, Olivia HopeNoNo
Match text
Cell Formulas
RangeFormula
C2:C23C2=IF(ISNUMBER(SEARCH(B1,A2:A23)),"Yes","No")
D2:D23D2=IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No")
Dynamic array formulas.
[/RANGE
Cell Formulas
RangeFormula
Dynamic array formulas.

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

See if one of these does what you want, noting especially row 16. Your initial description talked about "words" but your attempted formulas would have found "strings" not necessarily "words" so I'm not quite sure what you are after. (All the more reason for providing sample data and results as requested by @Cubist ;) )
To provide sample data (& expected results) I suggest that you investigate XL2BB.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)

Try these in row 2 (don't copy down the columns)
Adjust the column A range for your larger data.

The "word match" formula may not be very reliable if the column A data contains punctuation. If that is the case and you need more help, then varied sample data and the corresponding results become even more useful. :)

24 11 20.xlsm
ABCD
1NamesJohnText matchWord match
2John Michael SmithYesYes
3Smith, John MichaelYesYes
4Emily Rose CarterNoNo
5Carter, Emily RoseNoNo
6David L. JohnsonYesNo
7Johnson, David L.YesNo
8NoNo
9Thompson, Sophia AnneNoNo
10James O'ConnorNoNo
11O'Connor, JamesNoNo
12Robert K. WilliamsNoNo
13NoNo
14NoNo
15NoNo
16Tom MicheljohnYesNo
17Martinez, Benjamin G.NoNo
18Victoria F. CruzNoNo
19Cruz, Victoria F.NoNo
20Nathaniel Jameson BrownNoNo
21Brown, Nathaniel JamesonNoNo
22Olivia Hope GrantNoNo
23Grant, Olivia HopeNoNo
Match text
Cell Formulas
RangeFormula
C2:C23C2=IF(ISNUMBER(SEARCH(B1,A2:A23)),"Yes","No")
D2:D23D2=IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No")
Dynamic array formulas.
Hello Peter Thank you so much for your time. I will be using both your formulas, which are helpful.
I modified the D2 formula =IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No") I added the asterisk "*"&B1&"*". This gives me the search for multiple words. Thank you once again.

IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No")
IF(ISNUMBER(SEARCH(B1,A2:A23)),"Yes","No")
IF(ISNUMBER(SEARCH(" "&B1&" "," "&A2:A23&" ")),"Yes","No")
 
Upvote 0
Try. In C1
=IF($B1="","",IF(1*(ISNUMBER(FIND($B1,$A$1:$A$4))),"YES","NO"))
Mr Murthy, Thank you for your formula, Sorry the second formula was not helpful, however I will be using your formula along with Peters 2 formulas. Much appreciate for your time to help me.
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,054
Members
453,014
Latest member
Chris258

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