Extracting string between 2 characters

Ochoa11

New Member
Joined
Jun 4, 2019
Messages
2
[TABLE="width: 500"]
<tbody>[TR]
[TD]Account
[/TD]
[TD]Object code
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]001 -111141-
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -14559 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -99-01-X -121-00-54080 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -99-04-X -122-73-5L010 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -02-02-X -152-00-56133 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I am looking to extract the string between the 2 last hyphens. For example, i need to extract the object codes; 111141, 14559, 54080, 5L010, 56133.
How can I do this?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi,

This will also work:


Book1
AB
1AccountObject code
2001 -111141-111141
3001 -14559 -14559
4001 -99-01-X -121-00-54080 -54080
5001 -99-04-X -122-73-5L010 -5L010
6001 -02-02-X -152-00-56133 -56133
Sheet671
Cell Formulas
RangeFormula
B2=TRIM(RIGHT(SUBSTITUTE(A2,"-",REPT(" ",100)),200))
 
Upvote 0
[TABLE="width: 500"]
<tbody>[TR]
[TD]Account
[/TD]
[TD]Object code
[/TD]
[TD]Description
[/TD]
[/TR]
[TR]
[TD]001 -111141-
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -14559 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -99-01-X -121-00-54080 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -99-04-X -122-73-5L010 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]001 -02-02-X -152-00-56133 -
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I am looking to extract the string between the 2 last hyphens. For example, i need to extract the object codes; 111141, 14559, 54080, 5L010, 56133.
How can I do this?


Thank you! they both worked! AWESOME! You guys are brilliant!! Thanks again!
 
Upvote 0
You're welcome, welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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