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.
Who is Participating?
byundtConnect With a Mentor 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
End Sub

Open in new window

Hello there

Use your menu Data > Subtotals and launch your Subtotals window
Subtotal window
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.
pzozulkaAuthor 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).
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

This article might be helpful to you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.