Extracting part of a string

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,835
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Can't quite decide on a best method to achieve this.
I have a string delimited by vblf characters
One of the rows may start with "All" then " * by *"
If true, I want to get everything after "by " to end of that row (it will never be the last row in the string).
Not sure if RegEx or Filter will do it, or just split on vblf and check each row. Or something else?

Any suggestions ?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Peter, for a different purpose I've been trying to modify your RegExp to use a substring. But not succeeding (apart from looping with instr)
e.g. I send in the string and text to find and it returns any (vblf delimited) rows containing that text.
Is that possible ?
Thanks
 
Upvote 0
From that description I am not entirely clear of exactly what your data is like originally nor exactly what it should be like at the end. Please refer to post #5.
 
Upvote 0
Sorry, should have been more specific. I was hoping to create a standard routine
to extract a row from a string based on what I send in. This is an example - it's a vblf delimited string.

a) Ambrose & His Concert Orchestra v/Alan Kane (Decca F 8046)
b) Billy Cotton & His Band v/Alan Breeze (Rex 10085)
c) Carroll Gibbons & The Savoy Hotel Orpheans v/Leslie Douglas (Columbia FB 2748)
d) Flanagan & Allen (Decca F 8067)
e) Jack Daly (Regal Zonophone MR 3612)
f) Gay & Nevard (HMV BD 990)

And I could send in either
"d) " or "Flanagan & Allen" or "Decca F 8067"
to get the whole line "d) Flanagan & Allen (Decca F 8067)"

At the moment I'm splitting on vblf then using Filter. That many be good enough but I liked your
RegExp method very much and thought it more efficient.
 
Upvote 0
I still cannot see exactly what is in what cells nor exactly where the vblf's are.
I also don't know what you mean by "I could send in"

Could you not show before/after with XL2BB?
 
Upvote 0
It's a UDF in a module and the 'send in' is the argument passed to it.
I don't know what XL2BB is. The vblf are at the end of each row.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,681
Members
449,116
Latest member
HypnoFant

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