# Excel Subtotal Help

I have attached two Excel files below.

RawData.xlsx is the original sample data, and WantedData.xlsx is what I'm looking to accomplish.

I am basically doing SUBTOTAL, but in the subtotal group, that summarizes each subtotal, I want it to show the data summarizing the details. Doing a simple SUBTOTAL only gives you a subtotal without the summary of all the columns.
RawData.xlsx
WantedData.xlsx
LVL 8
###### Who is Participating?

Commented:
I can get close to the desired layout with the following macro:
``````Sub Subtotaller()
Dim cel As Range, rg As Range, rgSubtotals As Range
Application.ScreenUpdating = False
With ActiveSheet
Set rg = .Range("A1").CurrentRegion
rg.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(7), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Set rg = rg.Cells(1, 1).CurrentRegion
Set rgSubtotals = Range(rg.Cells(1, 2), rg.Cells(rg.Rows.Count - 1, 2)).SpecialCells(xlCellTypeBlanks)
.Outline.ShowLevels RowLevels:=2
End With
For Each cel In rgSubtotals
cel.Offset(-1, 0).Resize(2, 5).FillDown
cel.Resize(1, 6).Font.Bold = True
Next
End Sub
``````
0

Commented:
Hello there

Check all the columns you want to summarize (columns to which it will apply the function to summarize - Sum in this case)

For the text columns... you cannot apply a summarizing function... so they remain empty.
0

Author Commented:
As you said the text columns remain the same, and the InvAmt column gets summed up when all I want is to copy it into the summary row. In fact all of them should be copied into the summary row except PaidAmt column (which should be subtotaled).
0

Commented:
In that case you could do it using VBA
- create a routine that makes the subtotals
- for each sub-group copy the text values to the subtotal line