Find text within a cell using formula

laura_pink

New Member
Joined
Aug 21, 2014
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi, I am looking for a formula that will find me some text in a given column that always come after a specific phase.

Example, I have a column of data that contains a text dump from a system and hidden within the wordings is a sentence that always begins 'Pathway selected - ' and then a word will follow such as 'Pathway selected - headache'. I want a formula that tells me what word/s follows that set wording. Not sure if this is possible? I want it to tell me what text appears after the dash OR if it doesn't find the 'Pathways selected - ' wording then return 'NOT FOUND'.
I know this is some sort of IF statement but need help writing it please. Thanks in advance.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
What version of Excel are you using?

I suggest that you 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’)
 
Upvote 0
Apologies its office 365,
Microsoft® Excel® for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20586) 64-bit
 
Upvote 0
Thanks for that, how about
Excel Formula:
=TEXTAFTER(A2,"ed - ",,,,"not found")
 
Upvote 0
That works great thank you! My only problem is it puts all the text following it in a big string but I can’t think of a way around that. Might just do a text to columns after the first space and see if I can work it that way.
 
Upvote 0
That works great thank you! My only problem is it puts all the text following it in a big string but I can’t think of a way around that. Might just do a text to columns after the first space and see if I can work it that way.
Perhaps you could give us some sample data and expected results with XL2BB so that we can copy for testing?
 
Last edited:
Upvote 0
Like this?

=IFERROR(TRIM(LEFT(SUBSTITUTE(REPLACE(A2,1,FIND("ed - ",A2)+4,"")," ",REPT(" ",100)),100)),"not found")
 
Upvote 0
Like this?

=IFERROR(TRIM(LEFT(SUBSTITUTE(REPLACE(A2,1,FIND("ed - ",A2)+4,"")," ",REPT(" ",100)),100)),"not found")
Thanks this trims it down but as the text is in a dump and does not always have a space after the first word, and sometimes the wording I am looking for is multiple words, its a tough one. The textafter formula works best.
 
Upvote 0
Thanks for that, how about
Excel Formula:
=TEXTAFTER(A2,"ed - ",,,,"not found")
Hi would you mind advising me of how I would look across two columns for the same thing please so build on that formula to add in another column to look for that piece of text. It would need to be look at A2 or B2 for example as it wouldn't appear in both.
 
Upvote 0
Can you post some sample data & expected results as requested by Peter in post#6
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,218
Members
449,091
Latest member
jeremy_bp001

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