+ Reply to Thread
Results 1 to 2 of 2

Thread: Rows into column

  1. #1
    Registered User
    Join Date
    01-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Post Rows into column

    Hi here im attaching input data in input sheet and output data in output sheet any one help on this im having huge data which i was attached sample one.
    Attached Files Attached Files

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Rows into column

    Going with that layout, make sure your HEADERS are in the OUTPUT sheet the way you have now, then run this, it will put the items in matching order:

    Option Explicit
    
    Sub ReformatData()
    Dim LR As Long
    
    With Sheets("Input")
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("B2:B" & LR).FormulaR1C1 = _
            "=IF(LEFT(TRIM(RC[-1]),4)=""File"", TRIM(RC[-1])& ""-""&COUNTIF(R2C1:RC1,RC1), """")"
    End With
    
    With Sheets("Output")
        LR = Int(LR / 6) + 1
        .UsedRange.Offset(1).EntireRow.ClearContents
        With .Range("A2:F" & LR)
            .FormulaR1C1 = "=INDEX(Input!C1, MATCH(TRIM(R1C)&""-""&ROW(R[-1]C1), Input!C2, 0)+1)"
            .Value = .Value
            .SpecialCells(xlConstants, xlErrors).ClearContents
        End With
    End With
    
    Sheets("Input").Range("B:B").ClearContents
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ 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.2.0