Find end of period, insert 2 rows and total columns

charlie_580

Board Regular
Joined
Feb 3, 2007
Messages
56
Hi

I have a sheet with numerous rows of data. Cell A is the start date, Cell B is the end date, Cell D is the total number of days in the period and Cell E is the number of hours.

What I would like to do, is use a macro to split the rows into 5 and 7 month periods. April to August and September to March. So I want to insert 2 blank rows between the end of March and start of April, and insert 2 rows between the end of August and start of September. These dates can fall within any year, but will always be in oldest to newest order.

Once the blank rows are inserted, I then need to total the number of days in Column D and the number of Hours in Column E. There could be blank cells in these columns as well as text, both of which can be ignored.

I have included a screenshot test sheet showing how the finished sheet will look to hopefully help explain what the finished sheet will look like.

Thanks
 

Attachments

  • TEST Sheet.png
    TEST Sheet.png
    30.5 KB · Views: 12

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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