Этот VBA будет делать то, что вы хотите, но это не сводная таблица
Sub test()
'define variables
Dim RowNum as long, LastRow As long
'turn off screen updating
Application.ScreenUpdating = False
'start below titles and make full selection of data
RowNum = 2
LastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
Range("A2", Cells(LastRow, 3)).Select
'For loop for all rows in selection with cells
For Each Row In Selection
With Cells
'if date isn't blank
If Cells(RowNum, 3) <> "" Then
'and if customer name blank
If Cells(RowNum, 1) = "" Then
'and if category blank
If Cells(RowNum, 2) = "" Then
'concatenate and delete empty line
Cells(RowNum - 1, 3) = Cells(RowNum - 1, 3) & ", " & Cells(RowNum, 3)
Rows(RowNum).EntireRow.Delete
'since we deleted a row, go back a row
RowNum = RowNum - 1
End If
End If
End If
End With
'increase rownum for next test
RowNum = RowNum + 1
Next Row
'turn on screen updating
Application.ScreenUpdating = True
End Sub
и да, я действительно использовал часть своего кода из этой проблемы