+ Reply to Thread
Results 1 to 9 of 9

Transpose multiple cell groups of varying lengths

  1. #1
    Registered User
    Join Date
    04-25-2017
    Location
    Austin, TX
    MS-Off Ver
    Office 2015
    Posts
    4

    Transpose multiple cell groups of varying lengths

    Hello!

    I have a messy data problem I'm hoping for some help with. For a data analysis project, I've been scraping basic facebook user data resulting from a search (I'm aware of terms of service issues, and unfortunately the API won't cut it for what I'm doing). When the data gets dumped into excel it looks like this:

    Picture1.png

    And I'd like to get it transposed and sorted so it looks like this:

    Picture2.png

    I need each group of data to be transposed to rows, and because there are often several thousand groups of cells, I'd like to be able to do this without manually transposing each group. I've had success writing a macro that automatically copies and pastes>transpose each group, but I still have to highlight each group manually before pressing the hotkey for the macro, which means that it takes a couple hours, a red bull and hand cramps to transpose a longer list. Here's the really basic macro for transposing groups individually:

    Please Login or Register  to view this content.
    The real sticking point here is that the length of the groups of data/cells is variable. Sometimes there are four pieces of information in the group, sometimes three, sometimes two (excluding the "Add FriendMore Options" data which is, of course, removed). I've run this by a few excel wizards and they're stumped. I'd like to be able to tell the macro to find the next blank cell in column A, then highlight until the following blank cell, then perform the previously mentioned transpose function, but some serious googling hasn't resulted in any answers on how I might do this.

    I'm open to other solutions to this problem too - it doesn't have to be a macro. Although I'll go ahead and note that the obvious scrape software answers to this (i.e. iMacros, Data Miner, etc.) aren't helpful due to some browser memory issues involved in scrolling to the bottom of FB results. But any help or ideas would be greatly appreciated!

    Thanks,
    Mike
    Last edited by Mikestrauss35; 04-25-2017 at 04:30 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Transpose multiple cell groups of varying lengths

    Hi Mike

    i will look at this for you.

    Unfortunately i cannot reply until you comply with rule 3.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Transpose multiple cell groups of varying lengths

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  4. #4
    Registered User
    Join Date
    04-25-2017
    Location
    Austin, TX
    MS-Off Ver
    Office 2015
    Posts
    4

    Re: Transpose multiple cell groups of varying lengths

    Hi mehmetcik,

    Thanks for responding and for the link to the forum rules - I should've read them before posting! Below is the code within code tags and attached is an example workbook with desensitized data.

    Please Login or Register  to view this content.
    The above macro is also saved in the attached workbook as Macro1. Thanks again for offering to take a look!
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Transpose multiple cell groups of varying lengths

    Sorry Mike

    Post One needs to be amended to include Code Tags.

    The moderators insist on them.

    I have your macro ready,

  6. #6
    Registered User
    Join Date
    04-25-2017
    Location
    Austin, TX
    MS-Off Ver
    Office 2015
    Posts
    4

    Re: Transpose multiple cell groups of varying lengths

    Sorry, I misunderstood! I've just edited the original post so that it includes code tags. Thanks again

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Transpose multiple cell groups of varying lengths

    One way
    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Transpose multiple cell groups of varying lengths

    Mikes Solution is a lot neater than mine.

    Well done Mike.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 04-25-2017 at 08:36 PM.

  9. #9
    Registered User
    Join Date
    04-25-2017
    Location
    Austin, TX
    MS-Off Ver
    Office 2015
    Posts
    4

    Re: Transpose multiple cell groups of varying lengths

    Mike and mehmetcik -

    Thank you both so, so much! This is enormously helpful and will save my colleagues and I many, many hours of data work. I'll mark the thread as resolved.

    Best,
    Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Transpose Multiple (& Varying) Rows into Multiple (& Varying) Columns
    By Andrea9578 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2017, 11:46 AM
  2. Transpose Multiple (& Varying) Rows into Multiple (& Varying) Columns
    By Andrea9578 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2017, 02:05 AM
  3. Replies: 2
    Last Post: 09-06-2015, 02:57 AM
  4. [SOLVED] Need a macro to sum or subtotal ranges of varying lengths in a column
    By zookeepertx in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 05-12-2014, 06:14 AM
  5. [SOLVED] Sumproduct, Indirect, Address over multiple sheets and varying row lengths
    By dma1976 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-08-2014, 11:12 AM
  6. [SOLVED] Generic sort macro for varying lengths
    By s0o0y in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2013, 04:59 PM
  7. Apply Macro to varying row lengths
    By izza56 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2006, 10:36 AM

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