Extracting string between 2 characters

Ochoa11

New Member
Joined
Jun 4, 2019
Messages
2
Account
Object code
Description
001 -111141-
001 -14559 -
001 -99-01-X -121-00-54080 -
001 -99-04-X -122-73-5L010 -
001 -02-02-X -152-00-56133 -

<tbody>
</tbody>

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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Give this formula a try...

=TRIM(LEFT(RIGHT(SUBSTITUTE(A1,"-",REPT(" ",100)),200),100))
 
Upvote 0
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
Account
Object code
Description
001 -111141-
001 -14559 -
001 -99-01-X -121-00-54080 -
001 -99-04-X -122-73-5L010 -
001 -02-02-X -152-00-56133 -

<tbody>
</tbody>

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,216,765
Messages
6,132,589
Members
449,737
Latest member
naes

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