[英]Rounding numbers in complex conditions in Excel formula
I need to round up/down the numbers (last 2 digits, no decimal) based on three conditions: 我需要根据以下三种情况对数字进行四舍五入(最后两位数字,无小数点):
examples: 例子:
.................. ..................
假设值在a1中
=IF(MOD(A1,100)=0,A1-1,IF(MOD(A1,100)<51,A1+50-MOD(A1,100),A1+99-MOD(A1,100)))
Try this. 尝试这个。 (Its quite nice apart from the fudge at the end for the 0 case): (除了结尾为0的情况下的软糖之外,这非常不错):
=(CEILING(A1/50,1)*50)-IF(MOD(FLOOR((A1-1)/50,1),2)=1,1,0)
In explanation: 在解释中:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.