+ Reply to Thread
Results 1 to 14 of 14

Consolidate data from several columns to one

  1. #1
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Consolidate data from several columns to one

    Hi clever people,

    My issue is as old as few years now, yet still can't find a solution for it, so gave up searching and do the task manually. And the task is:

    Assume you have 4 columns of data. First column is for products A,B,C,D etc. The next three columns may or may not have subproducts in them i.e. A1,B1,C1,C2,C3 etc.

    The question arises then, how do I consolidate all products and subproducts in one column, which according to an example above would give me a result like this: A,A1,B,B1,C,C1,C2,C3,D.

    The solution can be either formula or a piece of a code, does not really matter!

    Thanks in advance!

    P.S. dummy attached...
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Consolidate data from several columns to one

    How does this look for a start?

    Need to think about what to do for duplicates if there will be any.
    Please do add reputation where you see fit, it's nice to be nice and we all enjoy a pat on the back

    Please also mark your thread as solved once it has been.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Consolidate data from several columns to one

    Try this

    Place your data on Sheet1 beginning at A1 without any headers
    Output is on Sheet2

    Please Login or Register  to view this content.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    Hi guys and thanks for a prompt response.

    PFDave, your solution works perfectly on a dummy, but... I forgot to mention that there is a gap in between products and subproducts. Products are in column A and subproducts are in columns W,X,Y. And I find difficult to adapt your code to make code work...

    Special-K - I'm testing yours now.

  5. #5
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    Special-K, good approach. I have inserted a few columns between products and subproducts, code did work, but dumps all the blanks on the list too. On the actual project those will be not blanks, but other data in between columns A & W,X,Y.

  6. #6
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Consolidate data from several columns to one

    My code will work for the problem you originally described.
    If you're going to start adding things after then be prepared for it not to work.

    The solution is to define exactly what you're trying to achieve at the beginning, not AFTER a solution has been provided.

    I'm now wondering if I provide a solution for your additional changes whether you're going to add more changes again in which case I will have been wasting my time on solving this problem which wasn't defined correctly, hence the comment below my signature regarding not having much time to solve these.
    Last edited by Special-K; 05-04-2017 at 07:55 AM.

  7. #7
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    Sorry, if I haven't described the issue clearly. Let me try again.

    The data range I'm working with is A1:Y1000.
    Top row is for headers.
    There will be blanks in the range except column A.
    There will be text and numeric values.
    The data to be extracted is from columns A,W,X,Y.

    I believe I have covered all now.

  8. #8
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    Bump!!!!!!!!!!!!!!!!!!!!

  9. #9
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Consolidate data from several columns to one

    Quote Originally Posted by ABSTRAKTUS View Post
    Sorry, if I haven't described the issue clearly. Let me try again.

    The data range I'm working with is A1:Y1000.
    Top row is for headers.
    There will be blanks in the range except column A.
    There will be text and numeric values.
    The data to be extracted is from columns A,W,X,Y.

    I believe I have covered all now.
    Let me get to it now

  10. #10
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Consolidate data from several columns to one

    Actually, where do you want the output to be placed? New Sheet? Certain column?

  11. #11
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    New sheet please...

  12. #12
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Consolidate data from several columns to one

    How about this one?

  13. #13
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: Consolidate data from several columns to one

    Hallelujah!!!

    Worked on your dummy, transferred the code onto the actual spreadsheet - works like a charm! Very neat piece of code, thanks a lot!

  14. #14
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Consolidate data from several columns to one

    You're Welcome and thanks for the rep.

+ 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. Replies: 2
    Last Post: 12-09-2016, 01:47 AM
  2. Consolidate data from different columns
    By Moazam Ali in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2016, 03:08 PM
  3. Merge/Consolidate data in specific columns
    By tjohnpok in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-25-2016, 02:15 PM
  4. Consolidate Data In Multiple Rows and Columns Into One Row
    By KiwDaWabbit in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-09-2015, 03:06 PM
  5. Replies: 1
    Last Post: 06-18-2014, 10:10 AM
  6. Consolidate Data withot Losing Other Columns
    By purpleeagle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2014, 07:45 PM
  7. [SOLVED] Consolidate text data from rows into columns
    By joevan1 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-29-2013, 01:10 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