+ Reply to Thread
Results 1 to 3 of 3

auto convert unique row data to columns

Hybrid View

  1. #1
    Registered User
    Join Date
    08-07-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    34

    auto convert unique row data to columns

    Please see the attached worksheet. I want the table in the right side to be dynamically auto-generated from the unique items in the table in the left.

    Thanks.
    Attached Files Attached Files
    Last edited by iRounak; 08-26-2010 at 12:33 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: auto convert unique row data to columns

    Hi

    Pretty crude, but should get you there.

    Sub aaa()
      For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        outcol = WorksheetFunction.Max(7, Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1).Column)
        If WorksheetFunction.CountIf(Range("a2").Resize(i, 1), Cells(i, 1).Value) = 1 Then
          Cells(1, outcol).Value = Cells(i, 1).Value
        End If
      Next i
    
      For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        outcol = WorksheetFunction.Match(Cells(i, 1), Rows("1:1"), 0)
        If WorksheetFunction.CountIf(Cells(1, outcol).EntireColumn, Cells(i, 2)) = 0 Then
          Cells(Rows.Count, outcol).End(xlUp).Offset(1, 0).Value = Cells(i, 2)
        End If
      
      Next i
    End Sub
    rylo

  3. #3
    Registered User
    Join Date
    08-07-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: auto convert unique row data to columns

    Thanks.
    I have marked the thread solved and added to the answerer's reputation but if there is a better solution please post it because I do not know why exactly is this solution "crude".

+ 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