简体   繁体   English

如何在excel中计算特定天数范围后的单元格值?

[英]How to calculate cell values after a certain days range in excel?

Here is the table and i need to calculate the amount based upon the days.这是表格,我需要根据天数计算金额。 参考表

cell For days 8 to 14 cell A shows 10000, for days 15 to 21 cell A shows B+C and after 21 days cell A shows B+C+D.单元格 对于第 8 到 14 天,单元格 A 显示 10000,对于第 15 到 21 天,单元格 A 显示 B+C,21 天后,单元格 A 显示 B+C+D。 After 28 days with every passing week it should add cell D values additionally.每过一周 28 天后,它应该额外添加单元格 D 值。 for example after 28 days calculation should be B+C+D+D and so on.例如28天后计算应该是B+C+D+D等等。

Here is the formula I'm using.这是我正在使用的公式。

=IF(AND($E$10>7,$E$10<=14),$B$10,IF(AND($E$10>14,$E$10<=21),SUM($B$10:$C$10),IF($E$10>21,SUM($B$10:$D$10),""))) 

need help to calculate values after 4 weeks, on every passing week value of cell D should be added.需要帮助计算 4 周后的值,每隔一周应添加单元格 D 的值。

Try:尝试:

=IF($E$10>21, $B$10+$C$10+(INT(($E$10-1)/7)-2)*$D$10, IF($E$10>14,$B$10+$C$10,IF($E$10>7,$B$10,0)))

In Excel, IF statement execution stops at the first logical test that returns TRUE , so by reversing the order of testing, we can eliminate all those AND functions you have in your original.在 Excel 中, IF语句的执行在第一个返回TRUE的逻辑测试处停止,因此通过颠倒测试顺序,我们可以消除原始中的所有AND函数。

Then it's just a matter of computing the correct number of D 's to add onto B and C然后只需计算正确数量的D添加到BC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM