split data across columns if the data is in one column only

anillinda

New Member
Joined
Apr 20, 2012
Messages
48
My data is in one column as follows:
NAME
DATE OF BIRTH
HIRE DATE
TERMINATION DATE
NAME
DATE OF BIRTH
HIRE DATE
TERMINATION DATE
NAME
DATE OF BIRTH
HIRE DATE
TERMINATION DATE

I need the name in one column and the date of birth in next column followed with hire date and termination date. How can I do this? I have over 3000 records.
Thanks
Neal
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
compile error: variable not defined
All that remained was to declare the variable f

Code:
Sub test4()
    Dim lr As Long, i As Long, [COLOR=#0000ff]f as range[/COLOR]
    lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To lr
        Set f = Range("A" & i & ":A" & lr).Find("Emp Type: Full time", LookIn:=xlValues, lookat:=xlPart)
        If Not f Is Nothing Then
            Range("B" & Rows.Count).End(xlUp)(2).Resize(1, f.Row - i).Value = WorksheetFunction.Transpose(Range("A" & i, Cells(f.Row, "A")).Value)
            i = f.Row
        End If
    Next
End Sub
 
Upvote 0
Here is a link to a file generated based upon your data that I have transformed using Power Query. Note that because your data is inconsistent in the number of records per person there is a slight hiccup in the transformation. This can be resolved using the same number of records per person. It appears that there is a salary field for one person but not the other.

https://app.box.com/s/ddz4ey8ond3uhu3zq1et5gays946m82v
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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