Split cell content into multiple rows, retaining adjeacent cell data

fmassa81

New Member
Joined
Aug 7, 2013
Messages
1
Folks,

This is my first time posting :eeek: and am really grateful for any help with my puzzle!

I'm working on a project where I have to count author publications across several academic journals. I have downloaded and organized all the data for these journals, but have been struggling to parse things out for an easy count.

I've been searching the forum for a straightforward way to split semi-colon delimited author names for a single article, create one row per co-author name and carry over the article details to the newly created rows.

My data looks something like this (except that rows continue all the way to column BD):


<tbody>
[TD="align: center"]Åstebro,Thomas;Bernhardt,Irwin

<tbody>
[TD="align: center"]Basic Statistics on the Success

<tbody>
[TD="align: center"] Authors [/TD]
[TD="align: center"] Number of Authors [/TD]
[TD="align: center"] Title [/TD]
[TD="align: center"] Periodical [/TD]

</tbody>
[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]The Winner's Curse of Human Capital[/TD]
[TD="align: center"]Small Business Economics[/TD]

[TD="align: center"]Åstebro,Thomas[/TD]
[TD="align: center"]1[/TD]

</tbody>
[/TD]
[TD="align: center"]Entrepreneurship: Theory & Practice[/TD]

[TD="align: center"]Demircan;Erturk,Alper[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]Technological Change[/TD]
[TD="align: center"]Small Business Economics[/TD]

</tbody>


I would like the data to look like this:



<tbody>
[TD="align: center"]Åstebro,Thomas

<tbody>
[TD="align: center"]Basic Statistics on the Success

<tbody>
[TD="align: center"] Authors [/TD]
[TD="align: center"] Number of Authors [/TD]
[TD="align: center"] Title [/TD]
[TD="align: center"] Periodical [/TD]

</tbody>
[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]The Winner's Curse of Human Capital[/TD]
[TD="align: center"]Small Business Economics[/TD]

[TD="align: center"]Bernhardt,Irwin[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]The Winner's Curse of Human Capital[/TD]
[TD="align: center"]Small Business Economics[/TD]

[TD="align: center"]Åstebro,Thomas[/TD]
[TD="align: center"]1[/TD]

</tbody>
[/TD]
[TD="align: center"]Entrepreneurship: Theory & Practice[/TD]

[TD="align: center"]Demircan;[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]Technological Change[/TD]
[TD="align: center"]Small Business Economics[/TD]

[TD="align: center"]Erturk,Alper[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]Technological Change[/TD]
[TD="align: center"]Small Business Economics[/TD]

</tbody>


In short, the author cells are split into multiple rows and all the adjacent data about the articles they co-authored up to Column BD gets carried over to the newly created row. There are a total of 7180 rows in my worksheet. My version of Excel is 2010.

Thank you advance for your help!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
the data is in sheet1 as follows

Excel Workbook
ABCD
1AuthorsNumber of AuthorsTitlePeriodical
2stebro,Thomas;Bernhardt,Irwin2The Winner's Curse of Human CapitalSmall Business Economics
3stebro,Thomas1Basic Statistics on the SuccessEntrepreneurship: Theory & Practice
4Demircan;Erturk,Alper2Technological ChangeSmall Business Economics
Sheet1



run tis macro and see sheet3

Code:
Dim r1 As Range, c1 As Range, dest As Range, k As Integer, j As Integer
Dim destr As Range
Sub test()
Set r1 = Range(Range("A2"), Range("A2").End(xlDown))
Set dest = Range("A1").End(xlDown).Offset(5, 0)




With Worksheets("sheet3")
.Cells.Clear
End With
Worksheets("sheet1").Activate




For Each c1 In r1
c1.TextToColumns Destination:=dest, DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
j = Cells(dest.Row, Columns.Count).End(xlToLeft).Column
'MsgBox j
For k = 1 To j


dest.Offset(0, k - 1).Copy
With Worksheets("sheet3")
Set destr = .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
destr.PasteSpecial
End With
Range(c1.Offset(0, 1), c1.End(xlToRight)).Copy
With Worksheets("sheet3")
destr.Offset(0, 1).PasteSpecial
End With


Next k


dest.EntireRow.Cells.Clear
nextc1:
Next c1
With Worksheets("sheet3")
Range(Range("A1"), Range("A1").End(xlToRight)).EntireColumn.AutoFit
End With
MsgBox "macro over"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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