[英]Calculate billable days in date range based on predefined week length
I am attempting to devise a formula that will allow for the correct billing days based on a predefined week length. 我正在尝试设计一个公式,该公式将根据预定义的周长来提供正确的结算天数。 Take this example:
举个例子:
Billing on a 3 day week would mean that 1-3 days would be billed on (Qty * Price Per)
but days 4-7 are essentially free. 每周进行3天的计费,意味着需要1-3天
(Qty * Price Per)
计费,但第4-7天基本上是免费的。 This would have to work for long period also. 这也必须长期工作。
More Examples: 更多示例:
Try this: 尝试这个:
=MIN(MOD(B4-B3+1,7),B5)*B1*B2+INT((B4-B3+1)/7)*B1*B2*B5
where: 哪里:
B1: Qty
B1:数量
B2: Price Per
B2:单价
B3: Date Start
B3:日期开始
B4: Date End
B4:日期结束
B5: Days per Week
B5:每周天数
With this setup: 使用此设置:
Breaking it down: 分解:
lesser of number days left over after subtracting the whole weeks, or maximum number of days to count in a week MIN(MOD(B4-B3+1,7),B5)
减去整周后剩余的天数较少,或一周中要计算的最大天数
MIN(MOD(B4-B3+1,7),B5)
Qty * Price Per
Qty * Price Per
number of whole weeks INT((B4-B3+1)/7)
整周数
INT((B4-B3+1)/7)
Qty * Price Per * Days in Week
Qty * Price Per * Days in Week
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.