Inserting new row(s) with subtotals based on multiple conditions

mcmichaeljs

New Member
Joined
Sep 18, 2014
Messages
2
I get a CSV file of varying length (# of rows) each month that contains a column for year (CCYY) and a non-adjacent column with either a greater than ">" or less than "<" value in it. After sorting the file by “>/<” within each year, I then need to start at the top row, and each time either the year value changes or the ">/<" value changes, I need to insert a row that counts and/or subtotals the values in several other columns based on the x number of non-blank rows above it where "x" is the number of rows since either the year or the">/<" value has changed. If the change is in the year value, I then also need to insert another blank row below the newly inserted subtotal row. I've tried doing this in two steps (first inserting a row every time the ">/<" changes and then inserting a row when the year changes, but with only partial success. It seems that this shouldn't be too difficult to do in VBA, but I haven't be able to get it. Any help is much appreciated.<o:p></o:p>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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