0

i had a list of people but it was on pdf i converted it to excel, result was this.

enter image description here

I want to know if something like this possible

enter image description here

With my imagination i was hoping there are something that i can do this. Start from first cell -> next cell -> next cell -> add data to NAME_ -> next cell .... -> next row -> add data to STREET NAME .....

I'm sorry if these doesn't make any sense :) i have no experience about this i know sql codes bu i don't think i will be able to get these in order with those codes there are 13056 rows at that excel file 13056/3=4352 people to export

At the end i want to be able to see people from "ŞANLIURFA" with sql codes

SELECT * FROM PEOPLE WHERE STATE/PROVINCE = "ŞANLIURFA"

EDIT

Sub fixData()
Dim writeRow As Integer

writeRow = 1
'Iterate through Sheet1 starting at row 9 and ending at 5000
'Skipping every 3 rows
For i = 11 To 5000 Step 3

    'Pick up the streetname from Sheet1 and stick it in Sheet2
    Sheet2.Cells(writeRow, 1).Value = Sheet1.Cells(i + 1, 1).Value  'Streetname
    Sheet2.Cells(writeRow, 2).Value = Sheet1.Cells(i + 1, 2).Value  'Building No
    Sheet2.Cells(writeRow, 3).Value = Sheet1.Cells(i + 1, 2).Value  'Daire No
    Sheet2.Cells(writeRow, 4).Value = Sheet1.Cells(i, 3).Value      'Name
    Sheet2.Cells(writeRow, 5).Value = Sheet1.Cells(i + 2, 3).Value  'Surname
    Sheet2.Cells(writeRow, 6).Value = Sheet1.Cells(i, 5).Value      'Gender
    Sheet2.Cells(writeRow, 7).Value = Sheet1.Cells(i, 6).Value      'Baba
    Sheet2.Cells(writeRow, 8).Value = Sheet1.Cells(i + 2, 6).Value  'Anne
    Sheet2.Cells(writeRow, 9).Value = Sheet1.Cells(i, 7).Value      'il
    Sheet2.Cells(writeRow, 10).Value = Sheet1.Cells(i + 2, 7).Value 'ilce

    '... like 10 more of these

    'Now we've written out one row to sheet2, increment to the next one
    writeRow = writeRow + 1
Next 
End Sub

VBA returns a compile error "object required", i checked other questions but couldnt understand.

This one I thought he was missing "Sub" and "End Sub" but that wasnt the case for me since i have it

1 Answers1

0

You use some VBA to do this. This isn't 100% written and it's making some assumptions (like we are reading data from Sheet1 and writing to Sheet2 and that your data goes up to row 5000).

Sub fixData()
    Dim writeRow As Integer

    writeRow = 1
    'Iterate through Sheet1 starting at row 9 and ending at 5000
    'Skipping every 3 rows
    For i = 9 To 5000 Step 3

        'Pick up the streetname from Sheet1 and stick it in Sheet2
        Sheet2.Cells(writeRow, 1).Value = Sheet1.Cells(i + 1, 1).Value 'Streetname
        Sheet2.Cells(writeRow, 2).Value = Sheet1.Cells(i + 1, 2).Value 'Building No
        Sheet2.Cells(writeRow, 3).Value = Sheet1.Cells(i, 3).Value 'Name
        Sheet2.Cells(writeRow, 4).Value = Sheet1.Cells(i + 2, 3).Value 'Surname
        '... like 10 more of these

        'Now we've written out one row to sheet2, increment to the next one
        writeRow = writeRow + 1
    Next
End Sub
JNevill
  • 46,980
  • 4
  • 38
  • 63