+ Reply to Thread
Results 1 to 4 of 4

Convert Table of Values into List

Hybrid View

  1. #1
    Registered User
    Join Date
    12-05-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Convert Table of Values into List

    Hi All

    First Post, am trying to make sure I follow forum ettiquette and I have tried searching for an answer to this question! Its probably that I am not searching the correct terms, so please forgive me if this has been answered already.

    Attached is an example of what I would like to achieve. It's sort of the opposite of a summary i.e. I have a table that shows

    A 2
    B 4
    C 6

    And what I would like to see iss

    A
    A
    B
    B
    B
    B
    C
    C
    C
    C
    C
    C

    This is just an example in reality I have to deal with 90+rows and possibly 100's of each of them.

    Thanks in advance

    Chris
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Convert Table of Values into List

    not good with formula, but in VBA, it can be done easily.

    Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets("Input")
    Dim i As Long, LR As Long, lFill As Long
    
    With ws
    .Columns("F").ClearContents
    LR = .Cells(Rows.Count, 1).End(xlUp).Row
        For i = 1 To LR
        lFill = .Cells(Rows.Count, 6).End(xlUp).Row + 1
            .Cells(lFill, 6).Value = .Cells(i, 2).Value
            .Cells(lFill, 6).AutoFill .Range(.Cells(lFill, 6), .Cells(lFill + .Cells(i, 2).Value - 1, 6))
        Next i
    End With
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-05-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Convert Table of Values into List

    Thanks, almost there I need to show A rather than 1, I think all I need to do is change

    .Cells(lFill, 6).Value = .Cells(i, 2).Value
    to

    .Cells(lFill, 6).Value = .Cells(i, 1).Value

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Convert Table of Values into List

    oops. yeah, you got it right. Just change the value to .cells(i,1).value

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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