VBA help needed please - splitting date range into monthly values!

Liam61

New Member
Joined
Dec 4, 2018
Messages
2
Hey guys,

First post here so please forgive me if I miss anything..

I am new to VBA and attempting to find some coding that will allow me to allocate the below section units between months based on course start and end dates.

I have entered a couple of lines below of what I'm working with. It is the values in bold that I would like to have automatically generated if possible, as this needs allocating over a 12 month period for over 5,000 course offerings.

The top row denotes the columns that are currently being used, but the dates currently run from Apr18 in column Q to Mar19 in column AB as shown.


[TABLE="width: 700"]
<tbody>[TR]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]N[/TD]
[TD]V[/TD]
[TD]W[/TD]
[TD]X[/TD]
[TD]Y[/TD]
[TD]Z[/TD]
[TD]AA[/TD]
[TD]AB[/TD]
[/TR]
[TR]
[TD]Course Meet Date[/TD]
[TD]Course End Date[/TD]
[TD]Course Length (Days)[/TD]
[TD]Section Units required[/TD]
[TD]Sep18[/TD]
[TD]Oct18[/TD]
[TD]Nov18[/TD]
[TD]Dec18[/TD]
[TD]Jan19[/TD]
[TD]Feb19[/TD]
[TD]Mar19[/TD]
[/TR]
[TR]
[TD]7-Jan-19[/TD]
[TD]31-Mar-19[/TD]
[TD]84[/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]0.6[/TD]
[TD]0.67[/TD]
[TD]0.74[/TD]
[/TR]
[TR]
[TD]4-Sep-18[/TD]
[TD]14-Dec-18[/TD]
[TD]102[/TD]
[TD]20[/TD]
[TD]5.29[/TD]
[TD]6.08[/TD]
[TD]5.88[/TD]
[TD]2.75[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

If anyone is able to offer any help that would be greatly appreciated!!

Kind regards
Liam
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to the Forum!

Is there any particular reason you wanted to use VBA, e.g. perhaps as a coding exercise to develop your VBA skills?

If not, perhaps a formula approach:

Q2: =IFERROR(1/(1/(MAX(0,MIN(EDATE(Q$1,1),$I2+1)-MAX(Q$1,$H2))*$N2/$J2)),"")
(Assuming dates in Q1, R1 etc are 1 April 2018, 1 May 2018 etc)


Book1
HIJKLMNOPQRSTUVWXYZAAABAC
1StartEndLengthUnitsApr-18May-18Jun-18Jul-18Aug-18Sep-18Oct-18Nov-18Dec-18Jan-19Feb-19Mar-19Apr-19
27-Jan-1931-Mar-198420.600.670.74
34-Sep-1814-Dec-18102205.296.085.882.75
Sheet1
 
Last edited:
Upvote 0

Similar threads

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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