VBA to split start date and end date into days per month in separate rows

motherindia

Board Regular
Joined
Oct 15, 2015
Messages
218
Hello Sir
I have data on sheet1 as follows;


[TABLE="width: 636"]
<tbody>[TR]
[TD]Cust ID[/TD]
[TD]Type [/TD]
[TD]Begin Date[/TD]
[TD]End Date[/TD]
[TD]No of days[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]23-Mar-17[/TD]
[TD="align: right"]23-Mar-17[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]28-Mar-17[/TD]
[TD="align: right"]28-Mar-17[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]29-Mar-17[/TD]
[TD="align: right"]29-Mar-17[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]30-Mar-17[/TD]
[TD="align: right"]30-Mar-17[/TD]
[TD="align: right"]0.5[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]31-Mar-17[/TD]
[TD="align: right"]31-Mar-17[/TD]
[TD="align: right"]0.5[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]08-Apr-17[/TD]
[TD="align: right"]08-Apr-17[/TD]
[TD="align: right"]0.5[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury[/TD]
[TD="align: right"]08-Apr-17[/TD]
[TD="align: right"]08-Apr-17[/TD]
[TD="align: right"]0.5[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Luxury [/TD]
[TD] 10-Apr-17[/TD]
[TD] 12-Apr-17[/TD]
[TD="align: right"]3[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]

Output needed as below;
[TABLE="width: 636"]
<tbody>[TR]
[TD]Cust ID[/TD]
[TD]Type [/TD]
[TD]Month-Year[/TD]
[TD]Day[/TD]
[TD]Total Days[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Luxury[/TD]
[TD]Mar-17[/TD]
[TD]23,28,29,30,31[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Luxury[/TD]
[TD]Apr-17[/TD]
[TD]8,10,11,12[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]

[TABLE="width: 599"]
<tbody>[TR]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD="align: right"]Regards,
motherindia[/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]
 
Wow, its working as I expected.
Thanks once again and you are really my great timesaver.

Regards,
motherindia
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,226,655
Messages
6,192,256
Members
453,711
Latest member
sumitkalra82

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