help: converting data from column to row

MatthiasK

New Member
Joined
Feb 19, 2010
Messages
3
Hi,

I want to analyse bibliographical data with excel and I need to split up data from one cell (author names, seperated by semicolon) and then convert it into new rows. Then I have to populate the data from the other cells to the new rows.

Here is a screenshot of the data:
001_original_data.png




...and this is how the data from the first row should look like after the conversion:

002_converted_data.png



I would be grateful for any help!
Thanks a lot!

Matt
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi Matt, perhaps this code will work for you. Try it on a copy of your data first, of course. :)
Code:
Sub expand()
Dim i As Long, rSize As Long
For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    With Cells(i, 1)
        If InStr(.Value, ";") > 0 Then
            rSplit = Split(.Value, ";")
            rSize = Len(.Value) - Len(Replace(.Value, ";", ""))
            .Offset(1, 0).Resize(rSize, 1).EntireRow.Insert
            .Offset(0, 1).Resize(rSize + 1, 3).FillDown
            For j = 0 To rSize
                Cells(i + j, 1).Value = rSplit(j)
            Next j
        End If
    End With
Next i
End Sub
 
Upvote 0
Dear Tom,
thanks so much! It works great and I managed to adjust the code a bit for other data, too. :)
Thanks again!
Greetings
Matt
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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