Insert Total and Sum After Each group of data

Zibi

Board Regular
Joined
Feb 2, 2012
Messages
73
Please Help,

I need help inserting Text that would say "Total" under each product group and Auto Sum for each group of data in the next column


Thanks
Apple3
Apple
Apple4
Apple
Apple
Total7
Orange
Orange3
Orange
Orange
Total3
Cheese9
Cheese
Cheese3
Total12

<COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><TBODY>
</TBODY>
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Subtotal would work if the rows of the different product would stay the same every time I pull the date. The issue is that every day when I pull the data that changes, and I have 100 to 200 items and need to sum every one separate.</SPAN>
 
Upvote 0
The spreadsheet is used also for inventory counting and next to each item there are batch codes, therefore I would like not to change the format just insert the totals between the different groups of items. Currently I am using some code to separate the different groups and create the space for the total lines</SPAN>



</SPAN>Sub Test()
Dim Rng As Range
Dim x As Long


'Good to insert 3 blanks'
' *** Change starting row and column reference to suit ***
Set Rng = Range("F1:F" & Range("F65536").End(xlUp).Row)
For x = Rng.Rows.Count To 2 Step -1
If Rng.Cells(x, 1).Offset(-1, 0).Value <> Rng.Cells(x, 1).Value Then
Rng.Cells(x, 1).EntireRow.Insert Shift:=xlDown

Rng.Cells(x, 1).EntireRow.Insert Shift:=xlDown
Rng.Cells(x, 1).EntireRow.Insert Shift:=xlDown

End If
Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,473
Messages
6,130,837
Members
449,597
Latest member
buikhanhsang

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top