Formula or VBA to split cell data into 5 columns

mcgee1505

New Member
Joined
May 20, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have searched the forum for a solution but nothing seems to fit what I need.

I have a worksheet with thousands of rows of data covering columns A - P. In column A is a product code set out in 5 sections with a 'dash' seperator e.g. 123456-ABC-ABC-ABC-123456. I would like a formula or VBA code to take the product code in column A and split it across columns Q - U. Can anyone help please?

Thanks in advance.
 
In the wizard did you select the final column & specify text?
When I do that I get
+Fluff v2.xlsm
AQRSTU
1Number
2123456-ABC-ACR-EMF-000001123456ABCACREMF000001
3123456-ABC-ACR-EMF-000002123456ABCACREMF000002
4123456-ABC-ACR-EMF-000003123456ABCACREMF000003
5123456-ABC-ACR-EMF-000004123456ABCACREMF000004
6123456-ABC-ACR-EMF-000005123456ABCACREMF000005
7123777-ABC-ACR-EMF-000154123777ABCACREMF000154
8123777-ABC-ACR-EMF-000155123777ABCACREMF000155
9123777-ABC-ACR-EMF-000156123777ABCACREMF000156
10123777-ABC-ACR-EMF-000157123777ABCACREMF000157
11123777-ABC-ACR-EMF-000158123777ABCACREMF000158
12123777-ABC-ACR-EMF-000159123777ABCACREMF000159
13123777-ABC-ACR-EMF-000160123777ABCACREMF000160
14435666-ABC-GGG-EMF-000352435666ABCGGGEMF000352
15435666-ABC-GGG-EMF-000353435666ABCGGGEMF000353
16435666-ABC-GGG-EMF-000354435666ABCGGGEMF000354
17435666-ABC-GGG-EMF-000355435666ABCGGGEMF000355
18435666-ABC-GGG-EMF-000356435666ABCGGGEMF000356
19435666-ABC-GGG-EMF-000357435666ABCGGGEMF000357
20123489-ABC-TBT-SSS-000002123489ABCTBTSSS000002
21123489-ABC-TBT-SSS-000003123489ABCTBTSSS000003
22123489-ABC-TBT-SSS-000004123489ABCTBTSSS000004
23123489-ABC-TBT-SSS-000005123489ABCTBTSSS000005
24123489-ABC-TBT-SSS-000006123489ABCTBTSSS000006
25123489-ABC-TBT-SSS-000007123489ABCTBTSSS000007
26123489-ABC-TBT-SSS-000008123489ABCTBTSSS000008
Data
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
OK Fluff, I have done it as Text-to-Columns and specified the last column as General. This works so I've recoreded it as a Macro and added it as a butto on my custom menu.

Code:
Sub Tests()
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("Q1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="-", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
        2)), TrailingMinusNumbers:=True
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,757
Members
448,991
Latest member
Hanakoro

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