Excel/Transposing multiple colums with alternating data
Hello, I am having some trouble trying to figure out how to do this.
My data starts in A1 below
012620 313035 15-52-A-01
012620 318515 20-15-A-01
012620 326003 20-20-A-02
014202 313061 15-49-A-02
014202 318498 20-27-B-01
But I need to move all the like items from A1 to a single row, alternating B1 and C1 until the next group of different number in A1 like below.
012620 313035 15-52-A-01 318515 20-15-A-01 326003 20-20-A-02
014202 313061 15-49-A-02 318498 20-27-B-01
Any help would be appreciated thanks.
Make a copy of your sheet with the data and run this macro against the copy:
Dim s As String, i As Long, j As Long
Dim col As Long
s = Left(Cells(1, "A").Value, 6)
i = 1
For j = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(j, 1) Like s & "*" Then
col = Cells(i, Columns.Count).End(xlToLeft).Column + 1
Cells(i, col).Value = Cells(j, "A").Value
s = Left(Cells(j, 1), 6)
i = i + 1
Cells(i, "A").Value = Cells(j, "A").Value
For your data you posted, that produced the results you show.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here