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
pzozulkaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArgentiCommented:
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.
0
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).
0
ArgentiCommented:
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.
0
byundtMechanical EngineerCommented:
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

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.