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 [TABLE="width: 500"]
<tbody>[TR]
[TD]12/21/2015[/TD]
[TD]1/22/2016[/TD]
[TD]531[/TD]
[/TR]
[TR]
[TD]1/22/2016[/TD]
[TD]2/22/2016[/TD]
[TD]416[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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")
[TABLE="width: 85%"]
<tbody></tbody>[/TABLE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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