+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2008
    Posts
    4

    Macro to convert 1 column to a 13 column x N row matrix

    I pasted a data table from a pdf into excel, and now I'm trying to recreate the table as it looked in the pdf. The pdf was in landscape mode, and unfortunately I couldn't find a pdf-to-excel conversion software that worked for this type of pdf. IF there was a good pdf-to-excel converter that would solve the problem. Any suggestions?

    IF there aren't:

    As it stands, I have a single column of data with ~600,000 rows and now trying to parses it into matrix of N rows by 13 columns.

    This would be a simple matter if the data were clean, but the data isn't cleanly divisible by 13, and correcting these data gaps would take a lot of time.

    Can I overcome this problem by selecting what the first value of each row in the matrix starts with? I have very limited experience writing macros (just started learning today), so I’d love to hear what more experienced people think. If my post is unclear, I am happy to clarify any of the details.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,714

    Re: Macro to convert 1 column to a 13 column x N row matrix

    Easiest if you attach a workbook with a sample of data as is, and desired results.

  3. #3
    Registered User
    Join Date
    03-08-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2008
    Posts
    4

    Re: Macro to convert 1 column to a 13 column x N row matrix

    Quote Originally Posted by StephenR View Post
    Easiest if you attach a workbook with a sample of data as is, and desired results.
    See attached file. thanks.
    Attached Files Attached Files

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

    Re: Macro to convert 1 column to a 13 column x N row matrix

    desired results
    Please can you add this bit - not sure what you want doing?

  5. #5
    Registered User
    Join Date
    03-08-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2008
    Posts
    4

    Re: Macro to convert 1 column to a 13 column x N row matrix

    Quote Originally Posted by StephenR View Post
    Please can you add this bit - not sure what you want doing?
    sure. what I want is to take my single column of data and make a 13 column x n matrix; taking the first 13 entries and making them the first row, the next 13 entries as the 2nd row, and so forth. I did this in excel with a function that basically sorts every 13 cells into a row, but that gets thrown off because there are sometimes more or less than 13 entries of data (ie. it isn't divisible by 13).

    This led me to believe that I was in macro-land, where I am not experienced enough to write the code. does this explain things?

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,714

    Re: Macro to convert 1 column to a 13 column x N row matrix

    Like so? Puts results on a second sheet. Still not entirely clear as your last post refers to rows. I've assumed you meant columns.
    Code:
    Sub x()
    
    Dim rng As Range
    
    Set rng = Sheet1.Range("A1").Resize(13)
    Do While Not IsEmpty(rng(1, 1))
        rng.Copy Sheet2.Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
        Set rng = rng.Offset(13)
    Loop
    
    End Sub

  7. #7
    Registered User
    Join Date
    03-08-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2008
    Posts
    4

    Re: Macro to convert 1 column to a 13 column x N row matrix

    Quote Originally Posted by StephenR View Post
    Like so? Puts results on a second sheet. Still not entirely clear as your last post refers to rows. I've assumed you meant columns.
    Code:
    Sub x()
    
    Dim rng As Range
    
    Set rng = Sheet1.Range("A1").Resize(13)
    Do While Not IsEmpty(rng(1, 1))
        rng.Copy Sheet2.Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
        Set rng = rng.Offset(13)
    Loop
    
    End Sub
    thanks for your ideas in thinking about this problem! I think i figured it out, with the help of a friend.

    [no more follow-up posts required]

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0