Need a formula to keep characters before a dash (-)

thgr8tone

New Member
Joined
Jun 27, 2014
Messages
4
I have a large list of data with the format of xxxx-xxx-xxxxxxx-xxxx (see examples below). I need to pull the data in front (to the left) of the first dash (-) into its own column. The rest of the data (to the right of the first dash) can be deleted. FYI, the data in front of the first dash could be between 3 characters in length to 30 characters in length.

Is there an excel formula or some form of code i could use to perform this action? Any questions, please let me know. In advance, thanks for your help!!! Rick

Data Examples
blic-slb-nw0203 --- Needs to be blic
lasvegas8-mdf-stk2 --- Needs to be lasvegas8
farmingtonhills5-qdf2s-aw18 ---- Needs to be farmingtonhills5
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi,

This should do it:


Excel 2010
AB
1Data Examples
2blic-slb-nw0203blic
3lasvegas8-mdf-stk2lasvegas8
4farmingtonhills5-qdf2s-aw18farmingtonhills5
Sheet1
Cell Formulas
RangeFormula
B2=LEFT(A2,FIND("-",A2)-1)

Formula copied down.
 
Upvote 0

Forum statistics

Threads
1,216,222
Messages
6,129,586
Members
449,520
Latest member
TBFrieds

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