how do i separate this string into various columns?

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
843
Office Version
  1. 2013
Platform
  1. Windows
This'll be a bit complicated I think. Hopefully the geniuses here can advise :)

I've got thousands of strings. Here's one example:
Computer-H000097050-LEXMARK INTERNATIONAL INC-Outside Processing [Shipping fee]-Nov

Hyphens separate what should be columns for the most part but not always.
So Computer should be a category, that belongs in one column.
H000097050-LEXMARK INTERNATIONAL INC should be the Vendor Name, that belongs in the next column. As you can see that has a hyphen in the name so that complicates things.
Outside Processing [Shipping fee] is the Desc, which goes in another column. In this case that looks clean enough but in some cases the Desc has a bloody hyphen, which kinda sucks.
And then there's the month which is self-explanatory.

So I think to start I'd like to pull out the Category and Month from this, and be left with a string of Vendor and Desc, from which I can try to figure things out further.

Can someone help with this please? I'd appreciate it.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Are there alway 4 hyphens inside?
Computer - Name1 - Name 2 - Desc - Month
Is this true?
Before 1st: Computer
After 1 st and before 3rd: Name 1 & 2
between 3rd and 4th: Desc
after last: Month
 
Upvote 0
Are there alway 4 hyphens inside?
Computer - Name1 - Name 2 - Desc - Month
Is this true?
Before 1st: Computer
After 1 st and before 3rd: Name 1 & 2
between 3rd and 4th: Desc
after last: Month
There's always hyphens between the categories. But the Vendor name apparently also has a hyphen sometimes, which complicates things.
Computer is a category. It wont always say Computer.
 
Upvote 0
Could you give more sample, using Xl2BB?
 
Upvote 0
Meeting part of your request, assuming the month is always a 3-character abbreviation:

Book3
A
1Computer-H000097050-LEXMARK INTERNATIONAL INC-Outside Processing [Shipping fee]-Nov
2Computer
3Nov
Sheet1
Cell Formulas
RangeFormula
A2A2=LEFT(A1,FIND("-",A1)-1)
A3A3=RIGHT(A1,3)
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,233
Members
449,092
Latest member
SCleaveland

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