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.


HIJNVWXYZAAAB
Course Meet DateCourse End DateCourse Length (Days)Section Units requiredSep18Oct18Nov18Dec18Jan19Feb19Mar19
7-Jan-1931-Mar-198420.60.670.74
4-Sep-1814-Dec-18102205.296.085.882.75

<tbody>
</tbody>

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

Kind regards
Liam
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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
Stephen, you are a genius!

I think I was honestly overthinking this.. thanks so much!

Liam
 
Upvote 0

Similar threads

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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