Find line in cell which contains multiple lines

Mongy

Board Regular
Joined
Dec 9, 2002
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Have a leave report which is auto produced from a payroll system which would look something like this, let's say in A2.
Looking to see if there is a formula which can do this, if not VBA.

Rich (BB code):
From Joe Bloggs 06-JUL-2022

Unimportant text
More Unimportant text
From Wednesday, 6 July 2022 to Friday, 8 July 2022
Yet more unimportant text

The number of lines in the cell may vary, there may be multiple lines which commence with the word FROM, and the line number in the cell may vary (eg won't always be the 5th line).
Need to extract the line where it may commence with "From Monday" (or any other day of the week), or may commence with "For one day on Tuesday" (or any other day of the week).
The text searching for in the line above should be unique in all the lines, except possibly line one, which could be a response From Wednesday Addams, so the text we're trying to find will not be in line one.

So would end up with a return of From Wednesday, 6 July 2022 to Friday, 8 July 2022.
From here, I would just add a macro to remove From, the days of the week, replace " to " with character and then text to columns, and will end up with two columns with 6 July 2022 and 8 July 2022.

Any help/pointers/suggestions would be appreciated :)
Cheers
 
I was just notified that you had marked my solution in this thread & it made me look at the problem again. I noticed that we can shorten those formulas quite a bit by not having to spell out all those month names in full if you are interested.
I hadn't marked it back then, and back to ask a different question, so thought would mark it.
I'm working on a different bit of work at the moment, but will go back and check it out when I can. Thanks :)
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,745
Messages
6,126,627
Members
449,323
Latest member
Smarti1

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