Results 1 to 9 of 9

Thread: Convert Matrix Style Data into Stacked Rows preserving identifying row values

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    14
    ad 1. Green, Bullen, Bovey, Alexander Excel 2007 VBA; Programmer's Reference ISBN 978-0-470-04643-2

    ad 2 & ad 3
    Code:
    Sub M_snb()
       sn = Cells(1).CurrentRegion
       sp = Cells(1).CurrentRegion.Resize(, 10)
       
       c00 = 1
       For j = 2 To UBound(sn)
         if(lcase(sn(j,1))="accrue" then c00 = c00 & Replace(String(17, "|"), "|", "|" & j)
       Next
       
       sq = Application.Index(sp, Application.Transpose(Split(c00, "|")), [transpose(row(1:10))])
       
       For j = 2 To UBound(sq)
          sq(j, 9) = "Brand " & (j - 2) Mod (17) + 1
          sq(j, 10) = sn((j + 15) \ 17 + 1, 8 + (j - 2) Mod (17) + 1)
       Next
       
       Cells(40, 1).Resize(UBound(sq), UBound(sq, 2)) = sq
    End Sub.
    ad 4. No need to adapt for larger datasets as long as no empty row/column makes part of it.
    Last edited by snb; 09-03-2014 at 01:22 PM.

Similar Threads

  1. Replies: 2
    Last Post: 03-08-2014, 02:49 AM
  2. Replies: 6
    Last Post: 12-23-2013, 04:07 PM
  3. Skip empty row and fetch values from other rows
    By dhivya.enjoy in forum Excel Help
    Replies: 1
    Last Post: 11-08-2013, 07:44 PM
  4. Replies: 10
    Last Post: 08-31-2013, 06:56 PM
  5. Group Pivot Data Based On Row Values In One Column
    By mrmmickle1 in forum Excel Help
    Replies: 10
    Last Post: 10-09-2012, 11:46 PM

Posting Permissions

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