imported comma seperated data

Kiwi den

Board Regular
Joined
Feb 17, 2014
Messages
148
Office Version
  1. 365
Platform
  1. Windows
I have a sheet that i want to import data to (sheet1 B2) this data is seperated by a comma i want to seperate and create it listed in a single column on (sheet 2 B2, B3, B4 etc)
can someone please help with a formula
thanks in advance
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi
Try


Code:
Sub test()
Dim Data
    With ThisWorkbook.Sheets("Sheet1")
        Data = .Range("b2")
    End With
    Data = Split(Data, ",")
    Sheets("sheet2").Cells(2, 2).Resize(UBound(Data)) = Application.Transpose(Data)
End Sub
 
Last edited:
Upvote 0
splitiing imported data into seperate cells

I have a sheet with imported data in cell A1 ( Bob, Carl, Kevin, Bill, Olly, Steve)
I would like to seperate these into seperate cells all in column A
So A2 = Bob
A3 = Carl
A4 = Kevin
A5 = Bill
A6 = Olly
A7 = Steve

Is there a formula at I can use to do this, or come someone direct me to where I can get this info
 
Upvote 0
Re: splitiing imported data into seperate cells

Do you want something to do all the steps or are you willing simply to use Text To Columns, then Copy, Paste Special, Transpose?

The macro recorder would give you this:

Code:
Sub Separate()
'
' Separate Macro
'

'
    Range("A1").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=True, Other:=False, FieldInfo:= _
        Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1)), _
        TrailingMinusNumbers:=True
    Rows("1:1").Select
    Selection.Copy
    Range("A2").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
End Sub
 
Last edited:
Upvote 0
Re: splitiing imported data into seperate cells

I have merged your two threads since they are asking the same question. Please refer to #12 of the Forum Rules and also #6 of the Forum Use Guidelines


For your question, try this copied down.

Excel Workbook
A
1Bob, Carl, Kevin, Bill, Olly, Steve
2Bob
3Carl
4Kevin
5Bill
6Olly
7Steve
8
Split values
 
Last edited:
Upvote 0
Actually, in case any names might contain spaces, perhaps safer with something like this.

Excel Workbook
A
1Bob, Carl, Kevin, John Boy, Olly, Steve
2Bob
3Carl
4Kevin
5John Boy
6Olly
7Steve
8
Split values
 
Upvote 0
Thank you, however I cannot get the formula to work, i have copied it into cell A2 and it just shows the formula, not theresult. Any thoughts?
The text you have in Red it shows an an error =TRIM(SUBSTITUTE(MID(SUBSTITUTE(A$1,",",REPT("#",100)),ROWS(A$2:A2)*100-99,100),"#"," "))
 
Last edited:
Upvote 0
i have copied it into cell A2 and it just shows the formula, not theresult. Any thoughts?
Most likely A2 is formatted as Text.
Select A2 and format it to General then press F2 followed by Enter to re-confirm the formula & then copy down.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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