Return value in text string between "\"

Bravo33

Board Regular
Joined
Jan 10, 2008
Messages
76
I have had a troll through and cannot seam to find any answers to a resolution for thew below scenario.

I have multiple text strings with "" in varying locations.Generally up to 1000 rows of which there are text strings withing the "" that I wish to retain.

Code:
ENQUIRY-01-01-08-18\W_SC-Lightning Protection\drgs-Low Option\
Code:
ENQUIRY-03-08-08-18\E_SC-Composite Concrete Decking\Specification-Low Option\
Code:
ADDITIONAL INFO-03-14-08-18\L_SC Stairs -ADDITIONAL INFO-03\

I would like to generate either VBA or a Macro to leave only the text between specific ""
For example:
Row 1 Remove
Code:
ENQUIRY-01-01-08-18\
&
Code:
\drgs-Low Option\
leaving
Code:
W_SC-Lightning Protection
Row 2 Remove
Code:
ENQUIRY-03-08-08-18\
&
Code:
\Specification-Low Option\
leaving
Code:
 E_SC-Composite Concrete 
Decking
Row 3 Remove
Code:
ADDITIONAL INFO-03-14-08-18\
& the last
Code:
\
leaving
Code:
L_SC Stairs -ADDITIONAL INFO-03

I would like to have the ability to select specific rows or number of rows and determine the number of leading and trailing
Code:
\
for text to be removed.

Any help greatly appreciated.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I'm not exactly clear what you want (too many code boxes ;)) but as far as I can understand it, you could do this with a standard worksheet formula as shown in column B below, or you could use a user-defined vba function as shown in the code below and column C in the screen shot.
If neither of these is what you want, please give further explanation/examples (just include the original data and the expected results).

Code:
Function Part(s As String, AfterDelimNum As Long) As String
  Part = Split(s, "\")(AfterDelimNum)
End Function

Excel Workbook
ABC
1ENQUIRY-01-01-08-18\W_SC-Lightning Protection\drgs-Low Option\W_SC-Lightning ProtectionW_SC-Lightning Protection
2ENQUIRY-03-08-08-18\E_SC-Composite Concrete Decking\Specification-Low Option\E_SC-Composite Concrete DeckingE_SC-Composite Concrete Decking
3ADDITIONAL INFO-03-14-08-18\L_SC Stairs -ADDITIONAL INFO-03\L_SC Stairs -ADDITIONAL INFO-03L_SC Stairs -ADDITIONAL INFO-03
Extract Text
 
Upvote 0
I'm not exactly clear what you want (too many code boxes ;)) but as far as I can understand it, you could do this with a standard worksheet formula as shown in column B below, or you could use a user-defined vba function as shown in the code below and column C in the screen shot.
If neither of these is what you want, please give further explanation/examples (just include the original data and the expected results).

Code:
Function Part(s As String, AfterDelimNum As Long) As String
  Part = Split(s, "\")(AfterDelimNum)
End Function

Excel Workbook
ABC
1ENQUIRY-01-01-08-18\W_SC-Lightning Protection\drgs-Low Option\W_SC-Lightning ProtectionW_SC-Lightning Protection
2ENQUIRY-03-08-08-18\E_SC-Composite Concrete Decking\Specification-Low Option\E_SC-Composite Concrete DeckingE_SC-Composite Concrete Decking
3ADDITIONAL INFO-03-14-08-18\L_SC Stairs -ADDITIONAL INFO-03\L_SC Stairs -ADDITIONAL INFO-03L_SC Stairs -ADDITIONAL INFO-03
Extract Text

Peter,
Many thanks for your swift response.
The formula is perfect.

You just saved me hours of work....Thanks!!
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,492
Members
448,967
Latest member
visheshkotha

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