Results 1 to 8 of 8

Thread: Transpose from columns only found items

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    443
    Location
    Or consider this VBA:
        Dim i As Integer, x  As Integer, r As Integer, c As Integer
        With ThisWorkbook.Worksheets("Table1")
        .Range("AW:BC").ClearContents
        r = 3
        For i = 1 To 48
            c = 50
            For x = 11 To 55
                .Cells(r, 49) = i
                If Not IsError(Application.Match(.Cells(x, i), .Range("A2:F2"), 0)) Then
                    .Cells(r, c) = .Cells(x, i)
                    c = c + 1
                End If
            Next
            r = r + 1
        Next
        End With
    Getting values for each output row into numerical order will require more code, probably involving an array or collection and a sort operation.

    And I figured out an Excel formula to return data for a column.
    Will have to modify the column letter for each row in the output range. Example for first two.
    =TRANSPOSE(SORT(FILTER(A$11:A$55,COUNTIF($A$2:$F$2,A$11:A$55))))
    =TRANSPOSE(SORT(FILTER(B$11:B$55,COUNTIF($A$2:$F$2,B$11:B$55))))
    No idea if a single formula could be constructed to accomplish this dynamically for all columns.
    Last edited by June7; 09-02-2024 at 08:30 PM.
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •