+ Reply to Thread
Results 1 to 4 of 4

restructuring data

  1. #1
    Registered User
    Join Date
    10-15-2009
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    7

    restructuring data

    I have a spreadsheet with data points collected on different lines/tracks. Line/track names are Line 1, Line 2 ...etc. The spreadsheet is ordered by these lines/tracks with the line/track name as heading and the points with the information on rows. Each time there is a new line/track there is a blank row and then a heading with the new line/track name and the points data following. To import the data into a database I must get rid of the line name heading and put the line name in a new column, i.e. each record will have a field/column called "Line_name". getting rid of the header rows is not such an issue, but getting the line names in a new column will take a long time.

    Is there a way to reorder this without copy and pasting hundreds of lines?


    see attached spread sheet.
    Attached Files Attached Files
    Last edited by Klipvis; 10-16-2009 at 05:45 AM. Reason: clarify the problem more clearly

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: restructuring data

    With code, yes, but you really should lose those merged cells. They make life really difficult.

    EDIT: de-merge the Line Number cells and try this:
    Please Login or Register  to view this content.
    Last edited by StephenR; 10-16-2009 at 06:54 AM.

  3. #3
    Registered User
    Join Date
    10-15-2009
    Location
    Cape Town
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: restructuring data

    Thanks for the quick reply.

    the code put me on the right track, but I think something is amiss with an offset somewhere. It did not like the empty rows in the spreadsheet, so I removed all the unnecessary rows. This causes an offset problem though; the first 2 records after the first header is missing in the results and the 1st 2 records of subsequent headers gets the previous line number assigned to it.

    I attached the result if you can please assist again, my VB is not so good.
    Actually, I think I stuffed it up good now, the 1st line number continues far down the list...

    thanks
    Wilhelm
    Attached Files Attached Files
    Last edited by Klipvis; 10-21-2009 at 05:14 AM.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: restructuring data

    Yes, that data look quite different from your original example. The code worked for your original as far as I could see, but in your second example you need to remove the blank columns and keep a blank row before each "Line Number". Change the layout and I'm afraid it's unlikely the code will still work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1