VBA - Date and time

Caramelsky88

New Member
Joined
Oct 11, 2017
Messages
2
Hi everyone!

I have a VBA question that is stumping me. I need a formula that looks at the date and based on how many days there are in the month divides the number next to it and allocates the rest of the amount to the following month. like for example:

If these are the date ranges
12/21/20151/22/2016531
1/22/20162/22/2016416

<tbody>
</tbody>

I would need to find out how much of the 531 and 416 are apart of Jan 2016. Can someone help out with this??

Thanks in advance!:confused::confused::confused::confused:
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Here is a non-vba solution with helper columns.


Excel 2016 (Windows) 32 bit
ABCDEFG
1StartEndValueCurrent MonthNext MonthDays in MonthDays to End of Month
212/21/20151/22/2016531171.2903226359.7096773110
31/22/20162/22/2016416120.7741935295.225806319
4
Sheet1
Cell Formulas
RangeFormula
D2=(G2/F2)*C2
D3=(G3/F3)*C3
E2=C2-D2
E3=C3-D3
F2=DATEDIF(EOMONTH(A2,-1),EOMONTH(A2,0),"D")
F3=DATEDIF(EOMONTH(A3,-1),EOMONTH(A3,0),"D")
G2=DATEDIF(A2,EOMONTH(A2,0),"D")
G3=DATEDIF(A3,EOMONTH(A3,0),"D")

<tbody></tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,386
Messages
6,124,628
Members
449,176
Latest member
Dazjlbb

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