Fixed minimum rate for prorating calculation

Lil Stinker

Board Regular
Joined
Feb 16, 2022
Messages
151
Office Version
  1. 2019
Platform
  1. Windows
Hello-
I'm looking for a way to fix in a minimum rate when calculating for monthly or weekly rental terms. In the samples below, I have the same table indicating the result for a monthly rental and a weekly rental based on a drop down in column E. The idea is the user will select Months or Weeks based on the term they are choosing for the rental when placing an order. Each term however, has a minimum rental rate regardless of which is chosen. Weekly rentals have a minimum 7-day rental while Monthly has a minimum one month rental. If a weekly rental is selected but the duration is less than 7 days, it should still total whatever weekly rate is listed in the Unit Rate column rather than breaking it down by the day as it currently does. Same for when a monthly rental is selected on the form, if the duration is less than a month, it should still total the monthly rate listed in column D. It is only after the minimum is met, does the rental start to prorate.

The two tables I have off to the right are there for calculating the proration for either rental term. I have it set up this way because this seems to produce the most accurate proration of rental rates for our needs. The problem is, it does not factor in a minimum rental period. So, I don't know if a more detailed IF statement in the Item Subtotal column is the way to go or if different formulas are needed in each of the calculation tables to factor in the minimum rental rate but I do know that I'm not smart enough to figure it out.

Any help would be greatly appreciated.

(By the way, this is meant to be used for drafting quotes to our clients. The start and end dates, equipment and rental rates are not fixed and will vary per quote).

ORDER FORM -formula tests- 2022.xlsx
ABCDEFGHIJKLMNOPQRS
17DescriptionQTYUnit RateMonthsItem Subtotal[ Term ]MonthsWeeksDaysWeekly RateDaily RateSubtotalWeeksDaysDaily RateSubtotal
18Computer Monitor1200.003w,6d$192.84Months0.003.006.0050.007.14192.843.006.0028.57771.42
19Speaker Set250.003w,6d$96.48Weeks0.003.006.0012.501.7996.483.006.007.14385.68
20Start DateKeyboard & Mouse Set120.003w,6d$19.260.003.006.005.000.7119.263.006.002.8677.16
2103/01/22Computer Tower1500.003w,6d$482.160.003.006.00125.0017.86482.163.006.0071.431928.58
22End Date            
2303/28/22            
24            
25            
26            
27Subtotal$790.74  
28Discount$0.00  
29Net Amount$790.74  
30TOTAL AMOUNT$790.74  
31
32DescriptionQTYUnit RateWeeksItem Subtotal[ Term ]MonthsWeeksDaysWeekly RateDaily RateSubtotalWeeksDaysDaily RateSubtotal
33Computer Monitor1200.006d$171.42Months0.000.006.0050.007.1442.840.006.0028.57171.42
34Speaker Set250.006d$85.68Weeks0.000.006.0012.501.7921.480.006.007.1485.68
35Start DateKeyboard & Mouse Set120.006d$17.160.000.006.005.000.714.260.006.002.8617.16
3604/01/22Computer Tower1500.006d$428.580.000.006.00125.0017.86107.160.006.0071.43428.58
37End Date            
3804/07/22            
39            
40            
41            
42Subtotal$702.84  
43Discount$0.00  
44Net Amount$702.84  
45TOTAL AMOUNT$702.84  
Sheet 2
Cell Formulas
RangeFormula
I18:I26I18=IF(ISBLANK(C18),"",DATEDIF($A$21,$A$23,"M"))
J18:J26J18=IF(ISBLANK(C18),"",INT(($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")))/7))
K18:K26K18=IF(ISBLANK(C18),"",MOD($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")),7))
L33:L41,L18:L26L18=IF(ISBLANK(C18),"",(ROUND(D18/4,2)))
M33:M41,M18:M26M18=IF(ISBLANK(C18),"",(ROUND(L18/7,2)))
N33:N41,N18:N26N18=IF(ISBLANK(C18),"",(D18*I18+L18*J18+M18*K18)*C18)
P18:P26P18=IF(ISBLANK(C18),"",INT((DATEDIF($A$21,$A$23,"d")/7)))
Q18:Q26Q18=IF(ISBLANK(C18),"",MOD($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")),7))
R33:R41,R18:R26R18=IF(ISBLANK(C18),"",(ROUND(D18/7,2)))
S33:S41,S18:S26S18=IF(ISBLANK(C18),"",(D18*P18+R18*Q18)*C18)
E18:E26E18=IF(OR($B18="",AND(E$17<>"Months",E$17<>"Weeks")),"", SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(IF(E$17="Months",DATEDIF($A$21,$A$23,"m")&"m,"&INT(($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")))/7)&"w,"&MOD($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")),7)&"d", INT(($A$23-$A$21)/7)&"w,"&MOD($A$23-$A$21,7)&"d"),"0m,",""),"0w,",""),",0d",""))
F18:F26F18=IF(ISBLANK(C18),"",IF(E$17="Months",(D18*I18+L18*J18+M18*K18)*C18,IF(E$17="Weeks",((D18*P18+R18*Q18)*C18))))
F27F27=SUBTOTAL(109,Table2261013[Item Subtotal])
L42:L45,L27:L30L27=IF(ISBLANK(C22),"",(ROUND(K27/7,2)))
M42:M45,M27:M30M27=IF(ISBLANK(C22),"",(D22*H27+K27*I27+L27*J27)*C22)
F29,F44F29=(F27-(F27*F28))
F30,F45F30=F29
I33:I41I33=IF(ISBLANK(C33),"",DATEDIF($A$36,$A$38,"M"))
J33:J41J33=IF(ISBLANK(C33),"",INT(($A$38-EDATE($A$36,DATEDIF($A$36,$A$38,"m")))/7))
K33:K41K33=IF(ISBLANK(C33),"",MOD($A$38-EDATE($A$36,DATEDIF($A$36,$A$38,"m")),7))
P33:P41P33=IF(ISBLANK(C33),"",INT((DATEDIF($A$36,$A$38,"d")/7)))
Q33:Q41Q33=IF(ISBLANK(C33),"",MOD($A$38-EDATE($A$36,DATEDIF($A$36,$A$38,"m")),7))
E33:E41E33=IF(OR($B33="",AND(E$32<>"Months",E$32<>"Weeks")),"", SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(IF(E$32="Months",DATEDIF($A$36,$A$38,"m")&"m,"&INT(($A$38-EDATE($A$36,DATEDIF($A$36,$A$38,"m")))/7)&"w,"&MOD($A$38-EDATE($A$36,DATEDIF($A$36,$A$38,"m")),7)&"d", INT(($A$38-$A$36)/7)&"w,"&MOD($A$38-$A$36,7)&"d"),"0m,",""),"0w,",""),",0d",""))
F33:F41F33=IF(ISBLANK(C33),"",IF(E$32="Months",(D33*I33+L33*J33+M33*K33)*C33,IF(E$32="Weeks",((D33*P33+R33*Q33)*C33))))
F42F42=SUBTOTAL(109,Table226101316[Item Subtotal])
Cells with Data Validation
CellAllowCriteria
E17List=$H$1:$H$3
E32List=$H$1:$H$3
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Could you clarify something, please? It appears that you manually input the column D Unit Rates (it's called a "rate", but the time component is not clear). Then on any given row, the Unit Rate is divided by 4 (for the Weekly Rate computation)...so this suggests the Unit Rate that was input is a Monthly Unit Rate. The Daily Rate computation then divides the Weekly Rate by 7 (no issues there). And the Subtotal computations also treat the "Unit Rate" as a monthly rate because it is multiplied directly by the number of months. But then there is another apparently superfluous computation of Daily Rate in column R that divides the column D "Unit Rate" by 7 (which now suggests that the unit rate is a weekly rate...and not a monthly rate). Is this an error, or can you explain the apparent discrepancy?
 
Upvote 0
Could you clarify something, please? It appears that you manually input the column D Unit Rates (it's called a "rate", but the time component is not clear). Then on any given row, the Unit Rate is divided by 4 (for the Weekly Rate computation)...so this suggests the Unit Rate that was input is a Monthly Unit Rate. The Daily Rate computation then divides the Weekly Rate by 7 (no issues there). And the Subtotal computations also treat the "Unit Rate" as a monthly rate because it is multiplied directly by the number of months. But then there is another apparently superfluous computation of Daily Rate in column R that divides the column D "Unit Rate" by 7 (which now suggests that the unit rate is a weekly rate...and not a monthly rate). Is this an error, or can you explain the apparent discrepancy?
Correct, the Unit Rate is entered manually. I should've changed the Unit Rates in the Weekly example to avoid any confusion but I was trying to show an apples to apples comparison when you flip from a Monthly rental to a Weekly rental. Typically, a weekly Unit Rate would be less than a monthly Unit Rate. Column R is showing the Daily Rate as broken down for a Weekly rate calculation therefore divided by 7.

The two tables on the right are basically there to "show my work" calculating the proration for a monthly rental rate (columns I:N) and a weekly rental rate separately (columns P:S). They're mainly there to catch any errors in case any of these complicated DATEDIF/EDATE formulas produce an anomaly (such as in leap years).

I hope that makes sense.
 
Upvote 0
Thanks. It sounds like the time component of the inputted Unit Rate is the one specified in the column E headings. So the top table Unit Rate is the cost per unit per month, and the bottom table Unit Rate is the cost per unit per week?
 
Upvote 0
Thanks. It sounds like the time component of the inputted Unit Rate is the one specified in the column E headings. So the top table Unit Rate is the cost per unit per month, and the bottom table Unit Rate is the cost per unit per week?
Yes, exactly!
 
Upvote 0
Have a look at this to see if it does what you want. This version includes conditionals that zero out months when the Terms are Weeks---this let's you use the same table for both Terms types by making just a few accommodations in the formulas. The rental period is also reported in the same format that you originally had. Formulas have been tightened up somewhat for consistency and efficiency. Here, cell E17 uses Data Validation so the user must select either Weeks or Months (and then the logical checks adjust the formulas to make a single helper table accommodate either option). I've incorporated a MAX function, which allows you to enforce a minimum charge for either of the Terms. Let me know if you have any questions or encounter issues. I haven't extensively tested this, but it appears to work for the few cases I tried. You may have to adjust the formulas for the number of m/d/y by a day in some cases depending on whether the beginning and/or end dates are to be counted, which depends on the convention you use...check those carefully.
mrexcel_20220406.xlsx
ABCDEFGHIJKLMNOPQ
17Date RangeDescriptionQTYUnit RateWeeksItem SubtotalTerms: WeeksNum MonthsNum WeeksNum DaysMonthly RateWeekly RateDaily RateSubtotalRental Period
18Computer Monitor12005w,3d1085.71Weeks053 20028.571085.710m,5w,3d
19Speaker Set2505w,3d542.84Weeks053 507.14542.840m,5w,3d
20Start DateKeyboard & Mouse Set1205w,3d108.58Weeks053 202.86108.580m,5w,3d
214/1/22Computer Tower15005w,3d2714.29Weeks053 50071.432714.290m,5w,3d
22End Date           
235/9/22           
24           
25           
26           
27Subtotal4451.42
28Discount10.0%
29Net Amount4006.28
30TOTAL AMOUNT4006.28
Sheet2
Cell Formulas
RangeFormula
I17I17="Terms: "&$E17
I18:I26I18=IF(ISBLANK(C18),"",SUBSTITUTE(I$17,"Terms: ",""))
J18:J26J18=IF(ISBLANK(C18),"",IF(I18="Months",DATEDIF($A$21,$A$23,"M"),0))
K18:K26K18=IF(ISBLANK(C18),"",QUOTIENT(DATEDIF(EDATE($A$21,J18),$A$23,"D"),7))
L18:L26L18=IF(ISBLANK(C18),"",MOD(DATEDIF($A$21,$A$23,"D"),7))
M18:M26M18=IF(ISBLANK(C18),"",IF(I18="Months",D18,""))
N18:N26N18=IF(ISBLANK(C18),"",IF(I18="Months",ROUND(D18/4,2),D18))
O18:O26O18=IF(ISBLANK(C18),"",(ROUND(N18/7,2)))
P18:P26P18=IF(ISBLANK(C18),"",C18*MAX(IF(I18="Months",M18,N18),SUMPRODUCT(J18:L18,M18:O18)))
Q18:Q26Q18=IF(ISBLANK(C18),"",J18&"m,"&K18&"w,"&L18&"d")
E18:E26E18=IF($B18="","",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Q18,"0m,",""),"0w,",""),",0d",""))
F18:F26F18=P18
F27F27=SUBTOTAL(109,F18:F26)
F29F29=F27*(1-F28)
F30F30=F29
Cells with Data Validation
CellAllowCriteria
E17ListMonths,Weeks
 
Upvote 0
Thanks for your feedback! I will take a look at this and try it out over the next few days and follow up with any questions.

Thanks again
 
Upvote 0
Hi Kirk-
Your sample layout is great, the simplicity is awesome! I'm still putting it through its paces but I've got one issue so far and one additional request.

Issue: I am getting wildly inconsistent results in the Number of Days, column L. For the most part, it counts the end day as part of the rental, which is actually preferred from a rental perspective (even if you return in the morning, you're still paying for the day). However, other times it's adding a couple days or even more. For instance, if I plug in Start: 04/12/22 and End: 06/11/22, I get back 1m, 4w, 4d with your formula when it's really 1m, 4w, 2d. Not sure where it's getting 2 extra days from. So I went back to the original day calculation formula I was using which matches the results I get from the Microsoft Date Calculator. Only problem with that formula is that it doesn't include the end date as a billed day. Is there a way to get the original formula to include the end day as opposed to just counting up to it? Original formula: =IF(ISBLANK(C18),"",MOD($A$23-EDATE($A$21,DATEDIF($A$21,$A$23,"m")),7))

Request: Is there a way to have the monthly calculation round up to a whole month any time the rental duration reaches 1 month and 4 weeks? Like in the example above, 1 month, 4 weeks and 2 days would just equal two months. Because, as it turns out, if we charge a rate of $200/mo and the client has the equipment out for 1m, 4w, 2d, it actually ends up costing more at 4w, 2d then it would for an even 2 month rental.

Thanks again for your help!
 
Upvote 0
I see the issue with "days". The current worksheet uses
Excel Formula:
MOD(DATEDIF($A$21,$A$23,"D"),7)
...and this will simply count the number of days between a start and end date. We perform a MOD 7 on that to get the number of days after accounting for weeks. But what if the date range spans months with 29, 30, 31 days? The formulas for months and weeks use: 1) DATEDIF with "M" (which counts number of months based on keeping the day "number" constant...so Apr 12 to May 12 to Jun 12 is two months); and 2) EDATE (which counts forward so many months). Since April has 30 days and May 31, these formulas that count months between dates or jump forward so many months don't care how many days are actually involved. The current "days" formula, however, is looking at leftover days after accounting for jumping through the date range a week at a time (7 days at a time). And since a month is rarely 28 days, the current formula isn't really in sync with with how the months and weeks are determined.

To fix this, it makes sense to revise the days formula to maintain the same convention used for months and weeks. We use the same basic formula found in the weeks formula, which returns days (where the number of days is operated on by taking the integer after dividing by 7....or QUOTIENT 7...to give number of weeks). Now we use the same formula for the number of days and subtract 7*(number of weeks) to give the leftover number of days.
Excel Formula:
DATEDIF(EDATE($A$21,J18),$A$23,"D")-7*K18

Tell me about counting the end date, as this may have implications for months, weeks, and days. If the start date is 04/12/22 and end date is 05/12/22, is that 1 month?... or 1 month and 1 day? The current formulas treat it as exactly one month, but 5/12/22 really represents the beginning of the 2nd month. If this makes sense to you and is consistent with your cost estimation method, then I think the formulas should be revised to include a "+1" where the end date appears (once in each of the formulas for months, weeks, and days).

The following sample includes all of the changes mentioned above.
mrexcel_20220406.xlsx
ABCDEFGHIJKLMNOPQ
17Date RangeDescriptionQTYUnit RateMonthsItem SubtotalTerms: MonthsNum MonthsNum WeeksNum DaysMonthly RateWeekly RateDaily RateSubtotalRental Period
18Computer Monitor12001m,4w,2d414.28Months142200507.14414.281m,4w,2d
19Speaker Set2501m,4w,2d207.16Months1425012.51.79207.161m,4w,2d
20Start DateKeyboard & Mouse Set1201m,4w,2d41.42Months1422050.7141.421m,4w,2d
214/12/22Computer Tower15001m,4w,2d1035.72Months14250012517.861035.721m,4w,2d
22End Date           
236/10/22           
24           
25           
26           
27Subtotal1698.58
28Discount10.0%
29Net Amount1528.72
30TOTAL AMOUNT1528.72
Lil Stinker
Cell Formulas
RangeFormula
I17I17="Terms: "&$E17
I18:I26I18=IF(ISBLANK(C18),"",SUBSTITUTE(I$17,"Terms: ",""))
J18:J26J18=IF(ISBLANK(C18),"",IF(I18="Months",DATEDIF($A$21,$A$23+1,"M"),0))
K18:K26K18=IF(ISBLANK(C18),"",QUOTIENT(DATEDIF(EDATE($A$21,J18),$A$23+1,"D"),7))
L18:L26L18=IF(ISBLANK(C18),"",DATEDIF(EDATE($A$21,J18),$A$23+1,"D")-7*K18)
M18:M26M18=IF(ISBLANK(C18),"",IF(I18="Months",D18,""))
N18:N26N18=IF(ISBLANK(C18),"",IF(I18="Months",ROUND(D18/4,2),D18))
O18:O26O18=IF(ISBLANK(C18),"",(ROUND(N18/7,2)))
P18:P26P18=IF(ISBLANK(C18),"",C18*MAX(IF(I18="Months",M18,N18),SUMPRODUCT(J18:L18,M18:O18)))
Q18:Q26Q18=IF(ISBLANK(C18),"",J18&"m,"&K18&"w,"&L18&"d")
E18:E26E18=IF($B18="","",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Q18,"0m,",""),"0w,",""),",0d",""))
F18:F26F18=P18
F27F27=SUBTOTAL(109,F18:F26)
F29F29=F27*(1-F28)
F30F30=F29
Cells with Data Validation
CellAllowCriteria
E17ListMonths,Weeks

As for the rounding question, I'm thinking about that. As the worksheet is currently set up, we would get a circular reference error because some decision on rounding months depends on the number of weeks, yet we use the number of months to determine the number of weeks. This suggests either a different approach is needed, or perhaps simpler, several more helper columns would be needed. Those helper columns would first perform the current calculations for months, weeks, and days. Then some logic would examine the number of weeks, and if W=4, then make M=M+1, W=0 and D=0. And if W<>4, then leave M, W, and D as they are. Then the cost calculations and Rental Period text string would refer to this conditional section for M/W/D rather than the original section for M/W/D. Are you okay with another 3 or 4 helper columns?
 
Upvote 0
Here is a version I described above: rounding using three more helper columns...
mrexcel_20220406.xlsx
ABCDEFGHIJKLMNOPQRST
16OriginalConditional
17Date RangeDescriptionQTYUnit RateMonthsItem SubtotalTerms: MonthsNum MonthsNum WeeksNum DaysNum MonthsNum WeeksNum DaysMonthly RateWeekly RateDaily RateSubtotalRental Period
18Computer Monitor12002m,1d407.14Months201201200507.14407.142m,0w,1d
19Speaker Set2502m,1d203.58Months2012015012.51.79203.582m,0w,1d
20Start DateKeyboard & Mouse Set1202m,1d40.71Months2012012050.7140.712m,0w,1d
214/12/22Computer Tower15002m,1d1017.86Months20120150012517.861017.862m,0w,1d
22End Date              
236/12/22              
24              
25              
26              
27Subtotal1669.29
28Discount10.0%
29Net Amount1502.36
30TOTAL AMOUNT1502.36
Lil Stinker
Cell Formulas
RangeFormula
I17I17="Terms: "&$E17
I18:I26I18=IF(ISBLANK(C18),"",SUBSTITUTE(I$17,"Terms: ",""))
J18:J26J18=IF(ISBLANK(C18),"",IF(I18="Months",DATEDIF($A$21,$A$23+1,"M"),0))
K18:K26K18=IF(ISBLANK(C18),"",QUOTIENT(DATEDIF(EDATE($A$21,J18),$A$23+1,"D"),7))
L18:L26L18=IF(ISBLANK(C18),"",DATEDIF(EDATE($A$21,J18),$A$23+1,"D")-7*K18)
M18:M26M18=IF(ISBLANK(C18),"",IF(K18>=4,J18+1,J18))
N18:N26N18=IF(ISBLANK(C18),"",IF(K18>=4,0,K18))
O18:O26O18=IF(ISBLANK(C18),"",IF(K18>=4,0,L18))
P18:P26P18=IF(ISBLANK(C18),"",IF(I18="Months",D18,""))
Q18:Q26Q18=IF(ISBLANK(C18),"",IF(I18="Months",ROUND(D18/4,2),D18))
R18:R26R18=IF(ISBLANK(C18),"",(ROUND(Q18/7,2)))
S18:S26S18=IF(ISBLANK(C18),"",C18*MAX(IF(I18="Months",P18,Q18),SUMPRODUCT(M18:O18,P18:R18)))
T18:T26T18=IF(ISBLANK(C18),"",M18&"m,"&N18&"w,"&O18&"d")
E18:E26E18=IF($B18="","",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(T18,"0m,",""),"0w,",""),",0d",""))
F18:F26F18=S18
F27F27=SUBTOTAL(109,F18:F26)
F29F29=F27*(1-F28)
F30F30=F29
Cells with Data Validation
CellAllowCriteria
E17ListMonths,Weeks
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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