+ Reply to Thread
Results 1 to 4 of 4

How to consolidate data containing multiple colums and rows into single row in order?

  1. #1
    Registered User
    Join Date
    04-30-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2013
    Posts
    11

    How to consolidate data containing multiple colums and rows into single row in order?

    Hi everyone

    My boss has given me data with 4 columns and thousands of row with hundreds of code.

    She wants it to be put in one row for each codes.

    The data looks like this:

    Column A represents codes. And columns B, C and D needs to keep their order when consolidated in one row.


    A| B| C| D|
    1| E| F| G|
    1| H| I| J |
    2| K| L| M|
    2| N| O| P|
    2| Q| R| S|


    I need to generate this so it will look like:

    A| B| C| D| B| C| D| B| C| D|
    1| E| F| G| H| I| J| | | |
    2| K| L| M| N| O| P| Q| R| S|


    I've spent hours googling but couldn't find any solutions yet.

    I believe it can be done by VBA coding...but I'm just a beginner and don't know where to start.

    I would really appreciate it if you could teach me how to do this!

    Many thanks


    Regards
    Last edited by seaspi; 04-30-2012 at 04:32 AM.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: How to consolidate data containing multiple colums and rows into single row in order?

    Try this:-
    Results start "F1".
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    04-30-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2013
    Posts
    11

    Re: How to consolidate data containing multiple colums and rows into single row in order?

    Hi Mick

    It works fantastic. You are just unbelievably admirable. Inspires me greatly.

    Just one question.. When I copy and paste your code as it is and run, it doesn't run with a msg box saying " Compile error: Statement invalid outside Type block"

    Then it higlights the first line "Sub MG30Apr17()"

    However, if i delete whole

    Dim Rng As Range
    Dn As Range
    Dim n As Long
    Dim Q

    it seems to work perfectly. Why do I get this msg?

    Anyway, thanks for your kind help. I really appreciate it.

    Regards

    Kyle

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: How to consolidate data containing multiple colums and rows into single row in order?

    I think the problem is my "Typo".
    Where you see:-
    Please Login or Register  to view this content.
    It should read:-
    Please Login or Register  to view this content.
    Notice the Extra "Dim"
    Usually this would have been picked up when I first ran the code, but for some reason it wasn't.

+ Reply to Thread

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.6.0 RC 1