I have some code that could work for you, but you'll have to modify it a bit or use the following method to make it work for your needs. (I don't have time to rewrite it at the moment.) Also, if you mean "table" like an Excel 2007+ table, you might have to convert it to a range before doing this.
Take your data, and perform a text-to-columns so that each comma value is separated in it's own column. It should look like this:
Sheet1
<table style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; " border="1" cellpadding="0" cellspacing="0"> <colgroup><col style="font-weight:bold; width:30px; "><col style="width:30px;"><col style="width:22px;"><col style="width:22px;"><col style="width:22px;"></colgroup><tbody><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td>
</td><td>A</td><td>B</td><td>C</td><td>D</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">1</td><td>
</td><td>
</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">2</td><td style="text-align:center; ">001</td><td style="text-align:center; ">E1</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">3</td><td style="text-align:center; ">002</td><td style="text-align:center; ">E1</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">4</td><td style="text-align:center; ">003</td><td style="text-align:center; ">E1</td><td style="text-align:center; ">E2</td><td>E3</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">5</td><td style="text-align:center; ">004</td><td style="text-align:center; ">E2</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">6</td><td style="text-align:center; ">005</td><td style="text-align:center; ">E3</td><td>
</td><td>
</td></tr></tbody></table>
Then, highlight the data, A1 to D6 (or whatever the furthest is). Its important that you have the blank space above it highlighted My macro process it and format it in this way:
Sheet1
<table style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; " border="1" cellpadding="0" cellspacing="0"> <colgroup><col style="font-weight:bold; width:30px; "><col style="width:30px;"><col style="width:30px;"><col style="width:22px;"></colgroup><tbody><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td>
</td><td>A</td><td>B</td><td>C</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">1</td><td>
</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">2</td><td style="text-align:center; ">001</td><td>
</td><td style="text-align:center; ">E1</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">3</td><td style="text-align:center; ">002</td><td>
</td><td style="text-align:center; ">E1</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">4</td><td style="text-align:center; ">003</td><td>
</td><td style="text-align:center; ">E1</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">5</td><td style="text-align:center; ">004</td><td>
</td><td style="text-align:center; ">E2</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">6</td><td style="text-align:center; ">005</td><td>
</td><td style="text-align:center; ">E3</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">7</td><td style="text-align:right; ">001</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">8</td><td style="text-align:right; ">002</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">9</td><td style="text-align:right; ">003</td><td>
</td><td style="text-align:center; ">E2</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">10</td><td style="text-align:right; ">004</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">11</td><td style="text-align:right; ">005</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">12</td><td style="text-align:right; ">001</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">13</td><td style="text-align:right; ">002</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">14</td><td style="text-align:right; ">003</td><td>
</td><td style="text-align:center; ">E3</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">15</td><td style="text-align:right; ">004</td><td>
</td><td>
</td></tr><tr style="height:18px ;"><td style="font-size:8pt; background-color:#cacaca; text-align:center; ">16</td><td style="text-align:right; ">005</td><td>
</td><td>
</td></tr></tbody></table>
You can then delete column B and run your pivot off those values keeping the blanks in there, or you can sort by column B (which was column C before you deleted blank column B) and delete the block of blanks and run you pivot.
The Macro is as follows:
Code:
Sub Data_To_Pivot()
Dim Rng As Range
Set Rng = Selection
Dim Count As Integer
Count = 1
Columns(2).Insert
Columns(2).Insert
Dim CurRow As Integer
Dim CurCol As Integer
Dim ToDo As Integer
Dim SourceRow As Integer
Dim SourceCol As Integer
ToDo = Rng.Columns.Count - 2
SourceRow = 2
CurRow = Rng.Rows.Count + 1
Do While ToDo > 2
Cells(CurRow, 1) = Rng.Cells(SourceRow, 1)
SourceRow = SourceRow + 1
CurRow = CurRow + 1
If SourceRow > Rng.Rows.Count Then ToDo = ToDo - 1
If SourceRow > Rng.Rows.Count Then SourceRow = 2
Loop
CurRow = 2
CurCol = 2
SourceRow = 1
SourceCol = 4
Do While SourceCol < Rng.Columns.Count + 2
Cells(CurRow, CurCol).Value = Cells(SourceRow, SourceCol).Value
CurRow = CurRow + 1
Count = Count + 1
If Count = Rng.Rows.Count Then SourceCol = SourceCol + 1
If Count = Rng.Rows.Count Then Count = 1
Loop
SourceCol = 4
SourceRow = 2
CurRow = 2
Do Until SourceCol = Rng.Columns.Count + 2
Cells(CurRow, 3).Value = Cells(SourceRow, SourceCol)
SourceRow = SourceRow + 1
CurRow = CurRow + 1
If SourceRow > Rng.Rows.Count Then SourceCol = SourceCol + 1
If SourceRow > Rng.Rows.Count Then SourceRow = 2
Loop
Range("D1:DD10000").Clear
Columns("B:C").HorizontalAlignment = xlCenter
Columns("A:C").EntireColumn.AutoFit
Range("A1").Select
End Sub
It's not pretty, but it should work for you. Hope it helps!