Find a specific word in a cell before a specific word

aghaffar82

Board Regular
Joined
Jun 13, 2019
Messages
65
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have this string in cell O1201 and formula in cell U1201

String:
Attorney/ownerLaw Office of Mark A. SkeltonCurrentLaw Office of Mark A. Skelton has served East Tennessee since 1983. The attorneys with the firm include Mark Albert Skelton and Amy Kathleen Skelton.

Formula:
=IFERROR(IF(IFERROR(SEARCH(B1201,O1201),IFERROR(SEARCH(LEFT(B1201,(FIND(" ",B1201,1)-1)),O1201),IFERROR(SEARCH(TRIM(RIGHT(SUBSTITUTE(B1201," ",REPT(" ",100)),100)),O1201),"")))<SEARCH("Current",O1201),"Yes","No"),"N/A")

Text in cell B1201:
Mark Albert Skelton

The formula is resulting in a "No", I want it to be a "Yes", the reason it is returning "No" is understood that it is finding an exact match of the value of B1201 after the word Current being the first condition, but I just want it to stay within the string before the word "Current" and if it doesn't find an exact match of the value in B1201 before the word Current, it should then look for first name and last name parts but also before the word Current.

Hope it makes sense, happy to clarify it further if needed. And thank you in advance for your kind consideration.
Best Regards
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
How about
Excel Formula:
=IFERROR(IF(IFERROR(SEARCH(B1201,LEFT(O1201,SEARCH("current",O1201))),IFERROR(SEARCH(LEFT(B1201,(FIND(" ",B1201,1)-1)),O1201),IFERROR(SEARCH(TRIM(RIGHT(SUBSTITUTE(B1201," ",REPT(" ",100)),100)),O1201),"")))<SEARCH("Current",O1201),"Yes","No"),"N/A")
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,524
Messages
6,114,117
Members
448,549
Latest member
brianhfield

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