Working Copy.xlsx
Hello. I am looking for assistance with the attached document. I am assisting with a program where they used to manually calculate each month. I was asked to come up with a formula that would do it automatically. I'm 95% there, but I keep having issues with February as a 30-day month. For context, we bill using 30-day months for 360 days a year.
OCT - JAN and MAR - SEP all calculate correctly using the following string: =$E3*((MAX(G$2-$A3,0)-MAX(DAYS(EOMONTH(G$2,-1),$A3),0))-(MAX(G$2-$B3,0)-MAX(DAYS(EOMONTH(G$2,-1),$B3),0))+(EOMONTH(G$2,0)=EOMONTH($A3,0)))
When calculated as a full month, Columns G - R must match the monthly rate in Column D. In order to do this, I had to change the end date of each month in Row 2 to 30 for those months ending in 31.
For FEB I had to change the formula slightly to add two days: =$E3*((MAX(K$2-$A3,0)-MAX(DAYS(EOMONTH(K$2,-1),$A3),0))-(MAX(K$2-$B3,-2)-MAX(DAYS(EOMONTH(K$2,-1),$B3),0))+(EOMONTH(K$2,0)=EOMONTH($A3,0)))
This change is where the issue lies. When the start date is after FEB 28, the daily rate is added for those two days, which in-turn throws off the Total Amount. Without it though, the monthly rate is short two days for start dates that begin before FEB.
Any assistance with this is greatly appreciated as I would like it to be one consistent formula throughout, rather than a separate formula for FEB.
Bookmarks