Need a code to sum various sized blocks of data

Jim885

Well-known Member
Joined
Jul 8, 2012
Messages
663
I have the below spreadsheet that I'm trying to get vba to sum each block of data, but not having much success.

As each block of data varies in row counts, I cant figure this one out.

I need the sums to appear in column H, next to Total:

Can someone help?

Thank you.

DateCrew NameAssignmentTotal
Count
Value Each
Value
Total: Costs $$
Remaining
Qty
Remaining
Percent
Completed
3/11/2020RobCode 2
26​
$ 20.00$ 520.00
10​
$ 200.00$ 10,440.00
522​
18%​
3/11/2020RobCode 4
15​
$ 80.00$ 1,200.00
2​
$ 2,523.46$ 30,281.54
24​
23%​
3/11/2020RobCode 2
11​
$ 150.00$ 1,650.00
25​
$ 4,250.00$ 16,660.00
98​
26%​
3/11/2020RobCode 3
23​
$ 20.00$ 460.00
80​
$ 1,600.00$ 8,840.00
442​
17%​
3/11/2020RobCode 1
15​
$ 60.00$ 900.00
15​
$ 17,407.41$ 6,425.16
147​
10%​
Total:
3/11/2020Jack#44
26​
$ 20.00$ 520.00
200​
$ 4,000.00$ 4,840.00
242​
55%​
3/11/2020Jack#21
84​
$ 10.00$ 840.00
25​
$ 4,250.00$ 12,410.00
73​
45%​
3/11/2020Jack#51
17​
$ 55.00$ 935.00
50​
$ 2,750.00$ 19,965.00
363​
12%​
3/11/2020Jack#24
11​
$ 90.00$ 990.00
10​
$ 1,987.67$ 23,056.98
116​
34%​
Total:
3/11/2020John#6
64​
$ 20.00$ 1,280.00
40​
$ 46,419.75$ 6,482.13
107​
34%​
Total:
3/11/2020Gerry#14
6​
$ 30.00$ 180.00
3​
$ 900.00$ 900.00
3​
50%​
Total:
3/11/2020CharlieCode 4
2​
$ 25.00$ 50.00
1​
$ 2,340.00$ -
0​
100%​
3/11/2020CharlieCode 2
4​
$ 16.00$ 64.00
1​
$ 2,340.00$ -
0​
100%​
3/11/2020CharlieCode 4
8​
$ 29.00$ 232.00
1​
$ 4,290.00$ -
0​
100%​
3/11/2020CharlieCode 2
3​
$ 12.00$ 36.00
0​
$ 4,290.00$ -
0​
100%​
3/11/2020CharlieCode 3
6​
$ 17.00$ 102.00
0​
$ 2,340.00$ -
0​
100%​
3/11/2020CharlieCode 1
9​
$ 32.00$ 288.00
0​
$ 300.00$ -
0​
100%​
Total:
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
How about
VBA Code:
Sub Jim()
   Dim Rng As Range
   For Each Rng In Range("H2", Range("H" & Rows.Count).End(xlUp)).SpecialCells(xlConstants).Areas
      Rng.Offset(Rng.Count).Resize(1).Formula = "=sum(" & Rng.Address & ")"
   Next Rng
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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