+ Reply to Thread
Results 1 to 17 of 17

Convert multiple column list to 1 linear list

  1. #1
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Convert multiple column list to 1 linear list

    Hi -

    I would like to convert a multiple columns into a linear table. It is possible to add new columns to the right or add new items to each list. How can I make a macro, that will able to list down items from the table (column A-E) to linear list (column G-I).

    Could someone help me or give me a reference code for this? Attached sample file.


    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Convert multiple column list to 1 linear list

    You can use PowerQuery, the free excel add on to do this without VBA.
    http://datapigtechnologies.com/blog/...data-explorer/
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Quote Originally Posted by mikeTRON View Post
    You can use PowerQuery, the free excel add on to do this without VBA.
    http://datapigtechnologies.com/blog/...data-explorer/
    I need a macro vba..

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

  5. #5
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    it was different set, i already saw codes like that what I need is different, take a closer look on the list, per column is a different list, that needs to be consolidated in one list.

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

    Re: Convert multiple column list to 1 linear list

    Try this for Results starting "G2".
    Please Login or Register  to view this content.
    Regards Mick

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,658

    Re: Convert multiple column list to 1 linear list

    Try this also:
    PHP Code: 
    Sub sd()
    Dim ArrP1(), ArrP2(), List1(), List2(), As Variant
    Dim sArr
    dArr As String
    ReDim ArrP1
    (1 To 41 To 5)
    ReDim ArrP2(1 To 41 To 5)
    Dim ijk
    [G3:I100].ClearContents
    ArrP1 
    Range("A4:E7")
    ArrP2 Range("A11:E14")
    For 
    1 To 5
        
    For 1 To 4
            
    If ArrP1(ij) = "" Then Exit For
            
    sArr ArrP1(ij) & "|"
            
    dArr dArr sArr
            k 
    Len(dArr) - Len(Replace(dArr"|"""))
            [
    H3].Offset(10).Value Cells(3j)
            [
    I3].Offset(10).Value ArrP1(ij)
            [
    G3].Offset(10).Value = [A2].Value
        Next i
    Next j
    For 1 To 5
        
    For 1 To 4
            
    If ArrP2(ij) = "" Then Exit For
            
    sArr ArrP2(ij) & "|"
            
    dArr dArr sArr
            k 
    Len(dArr) - Len(Replace(dArr"|"""))
            [
    H3].Offset(10).Value Cells(10j)
            [
    I3].Offset(10).Value ArrP2(ij)
            [
    G3].Offset(10).Value = [A9].Value
        Next i
    Next j
    End Sub 
    Quang PT

  8. #8
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Quote Originally Posted by MickG View Post
    Try this for Results starting "G2".
    Please Login or Register  to view this content.
    Regards Mick
    Im getting an error in "Lst = UsedRange.Rows.Count", and is not updating. Thanks.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,354

    Re: Convert multiple column list to 1 linear list

    The solution is easy.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  10. #10
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Quote Originally Posted by bakerman2 View Post
    The solution is easy.
    Please Login or Register  to view this content.
    thank you it is now working.

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

    Re: Convert multiple column list to 1 linear list

    Good catch bakerman2.
    SBBmaster09 ,you're welcome

  12. #12
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Hi would like to update this. How can I use the code when the data is from other workbookInput and would like to list it in workbookOutput?

  13. #13
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Quote Originally Posted by MickG View Post
    Try this for Results starting "G2".
    Please Login or Register  to view this content.
    Regards Mick

    Hi -

    How would I able to use this code if my column A-E is from workbookInput and column G-I should be to workbookOutput? I'm not that yet good in vba, apologize for the inconvenience.

    Thank you.

  14. #14
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    I tried the code you have given with my template, just got something, this line Left(R.Offset(, Ac).value, 4) = "List" means containing "List" value right? What if my header doesn't have the same value? It has different naming convention on headers. what should be the formula for this? thanks.

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

    Re: Convert multiple column list to 1 linear list

    Are those Names, workbook names or sheet names, if the former what are the sheet names.
    How would I able to use this code if my column A-E is from workbookInput and column G-I should be to workbookOutput? I'm not that yet good in vba, apologize for the inconvenience.


  16. #16
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Quote Originally Posted by MickG View Post
    Are those Names, workbook names or sheet names, if the former what are the sheet names.
    In my WorkbookInput sheetname is "BS" where the multiple columns(table) is, this is my source data. the WorkbookOutput sheetname "BS" is where I need to translate the columns to a linear list, The headers which are in the row 3 and 10 of the attached previous file, has different texts. It should not be just equal to "List". Row 10 can be possible to change since the items from the columns starting from row 3 is numerous.

    I hope I have explained it, thanks so much for the help.

  17. #17
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Convert multiple column list to 1 linear list

    Hi -

    I able to tweak the code for what I need, sharing this file and added comments for reference.

    Please Login or Register  to view this content.

+ 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: 10-25-2013, 07:01 PM
  2. Convert Array to 2-Column List
    By boboliverjr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-30-2013, 06:29 PM
  3. [SOLVED] Convert multiple names in cells of a Column to a List with single name in each cell
    By mvmathur in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2013, 12:04 PM
  4. Convert list to multiple columns conditionally
    By mmhaskar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2012, 10:37 AM
  5. [SOLVED] Convert Matrix to multi column list
    By nipeeter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2012, 07:38 AM
  6. [SOLVED] Convert Multiple Tables on a sheet to a List
    By smartk in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-22-2012, 11:29 AM
  7. convert list to column
    By guthrie in forum Excel General
    Replies: 3
    Last Post: 10-21-2010, 01:57 PM
  8. Convert Address List To Multiple Columns
    By passmaster16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2009, 02:57 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