Split multiline text to two column retaining the multiline row structure

tulasiraman

New Member
Joined
Feb 20, 2015
Messages
4
Hi,

My data looks like this (two rows, one column)

apple [fruit]
orange [color]
grapes [sour]

banana [yellow]
mango [sweet]

I want to convert them into (two rows, two column) as below

apple --------- fruit
orange ------- color
grapes ------- sour

banana ------- yellow
mango -------- sweet

Please provide me with a solution for this.

Thanks.
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Give this macro a try...
Code:
Sub SplitData()
  Columns("A").Copy Range("B1")
  With Range("A1", Cells(Rows.Count, "A").End(xlUp))
    .Replace "[*]", "", xlPart
    .Replace " " & vbLf, vbLf, xlPart
    .Cells = Evaluate("IF(LEN(" & .Address & ")="""","""",TRIM(" & .Address & "))")
  End With
  With Range("B1", Cells(Rows.Count, "A").End(xlUp))
    .Replace "]" & vbLf & "*[", vbLf, xlPart
    .Replace "]", "", xlPart
    .Replace "*[", "", xlPart
  End With
End Sub
 
Upvote 0
Hi,

My data looks like this (two rows, one column)

apple [fruit]
orange [color]
grapes [sour]

banana [yellow]
mango [sweet]

I want to convert them into (two rows, two column) as below

apple --------- fruit
orange ------- color
grapes ------- sour

banana ------- yellow
mango -------- sweet

Please provide me with a solution for this.

Thanks.

Data - Text to Columns
 
Upvote 0
Hi Vanda... Your solution works for single line text only... Anyway Rick has provided with the solution... Thanks...
 
Upvote 0

Forum statistics

Threads
1,214,887
Messages
6,122,095
Members
449,064
Latest member
Danger_SF

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