SUM rows based on multiple criteria and insert below

sjk1193

New Member
Joined
Nov 12, 2018
Messages
29
So what i need to do is sum the values in the Units and amount columns if :
- the person is the same
- "x" starting number of characters is same in the desc column (ex. one__ or three____)
- the Cur being "U"

Then i need to insert a new BOLDED row underneath each change in colour in the rows with the sums of the units and amount columns


groupPersonDescCurxxUnitsxxamount
111abcone - 1Uxx531xx35146
111abcone - 23Uxx785xx584684
111abcone - 4 Uxx9xx4125
222defone - 1Uxx-65xx452
222defone - 23Uxx45xx-52
222defone - 4 Uxx41xx852
333hijthree- 9Uxx-546xx452
333hijthree - 4Uxx254xx45
444klmtwo - 9Uxx-2xx2263
444klmtwo - 4Uxx45xx-35
444klmtwo- 6Cxx345xx4587
444klmtwo - 8Cxx35xx753

<tbody>
</tbody>


so after it would kind of look like it looks for the brown rows for all of the colours

groupPersonDescCurxxUnitsxxamount
111abcone - 1Uxx531xx35146
111abcone - 23Uxx785xx584684
111abcone - 4 Uxx9xx4125
111abc1325623955
222defone - 1Uxx-65xx452
222defone - 23Uxx45xx52
222defone - 4 Uxx41xx852
333hijthree- 9Uxx-546xx452
333hijthree - 4Uxx254xx45
444klmtwo - 9Uxx-2xx2263
444klmtwo - 4Uxx45xx35
444klmtwo- 6Cxx345xx4587
444klmtwo - 8Cxx35xx753


<tbody>
</tbody>


 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Why not just make a pivot table? You could get the desired result for all the columns that have the matching criteria you are explaining in your question.
 
Upvote 0
It's fine. We've all done it before. Sometimes over engineering a solution that Excel can already handle with Pivots or other means.

If the data set grows one approach for automation with a macro could be for you to give your pivot source data a named range so that you can control that aspect with a macro that redefines the last row as the report grows.
 
Upvote 0

Forum statistics

Threads
1,215,269
Messages
6,123,976
Members
449,138
Latest member
abdahsankhan

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