Format Report-Vertical to Horizontal?

sammipd

Board Regular
Joined
Jun 6, 2010
Messages
67
My spreadsheet of 700 rows looks like Table1 and I must create a report formatted as Table2. I'm having no success with pivot tables and know no other way. The File#'s each have between 1 and 15 rows of Content. Can anyone help? I'm using Excel 2007. Thanks!
Table1
File#Content
1001aaaa
1001bbbb
1001cccc
2002xxxx
2002yyyy
2002zzzz

<TBODY>
</TBODY>

Table2
File #Content-1Content-2Content-3
1001aaaaabbbbcccc
2002xxxxyyyyzzzz

<TBODY>
</TBODY>
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Why not just copy/pastespecial/transpose? Or, =transpose() entered as an array and then copy/pastespecial/values?? If you only have to do it 10 times it shouldn't take more than 3 to 5 minutes.

***Edit:

Don't do what I said above, I didn't notice your data set.

Use Vlookup instead!
 
Upvote 0
My VLookup skills are minimal. How do I tell Excel to look for the 2-15 of the Content rows for the same File#?
 
Upvote 0
My spreadsheet of 700 rows looks like Table1 and I must create a report formatted as Table2. I'm having no success with pivot tables and know no other way. The File#'s each have between 1 and 15 rows of Content. Can anyone help? I'm using Excel 2007. Thanks!
Table1
File#Content
1001aaaa
1001bbbb
1001cccc
2002xxxx
2002yyyy
2002zzzz

<tbody>
</tbody>

Table2
File #Content-1Content-2Content-3
1001aaaaabbbbcccc
2002xxxxyyyyzzzz

<tbody>
</tbody>
If you're happy with VBA macros, try running this one on a test sheet. It should start your reordered data from cell D1
Code:
Sub reorder()Dim d As Object, u(), c()
Dim a, e, ra As Long, i As Long
Set d = CreateObject("scripting.dictionary")
a = Range("A1").CurrentRegion
ra = UBound(a, 1)
ReDim u(1 To ra, 1 To 2), c(1 To ra + 1)
For i = 2 To ra
    e = a(i, 1)
    If Not d.exists(e) Then
        d(e) = d.Count + 1
        u(d(e), 1) = e
        u(d(e), 2) = a(i, 2)
        c(d(e)) = 2
    Else
        c(d(e)) = c(d(e)) + 1
        If c(d(e)) > UBound(u, 2) Then _
            ReDim Preserve u(1 To ra, 1 To c(d(e)))
        u(d(e), c(d(e))) = a(i, 2)
    End If
Next i
Cells(1, 4) = "File#"
For i = 1 To UBound(u, 2) - 1
    Cells(1, 4 + i) = "Content" & i
Next i
Cells(2, 4).Resize(d.Count, UBound(u, 2)) = u
End Sub
This is faster than doing it with a pivot table, and less setting up needed.
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,755
Members
449,187
Latest member
hermansoa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top