如何四舍五入
我认为这可能是一件容易的任务,我尝试在社区中搜索,但找不到我想要的那个,所以我有一些数字,并且想
在 | 四舍五入 |
---|---|
431 | 435 |
432 | 之前围绕一个特定的数字。 435 |
433 | 435 |
434 | 435 |
435 | 435 |
435 | 429 |
436 | 439 |
437 | 437 439 |
438 | 439 439 |
439 | 439 439 |
440 | 439 |
因此,如果最后一个数字在1-5之间,则IE 432将变为435;虽然437变为439。也是上面显示的示例数据,但我尝试使用MROUND或地板功能,但没有通过它来解决此问题
I assume this may be an easy task, I have tried searching in the community, but can't find the one which I am looking for, so i have some numbers and want to round to a specific number,
BEFORE | AFTER ROUNDED |
---|---|
431 | 435 |
432 | 435 |
433 | 435 |
434 | 435 |
435 | 435 |
430 | 429 |
436 | 439 |
437 | 439 |
438 | 439 |
439 | 439 |
440 | 439 |
So, if the last digit is between 1-5 it will be i.e. 432 becomes 435; while 437 becomes 439. Also a sample data shown above, i have tried using MROUND or FLOOR Function but not getting through it, any way to get around this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试:
try:
好的,这有点棘手。我主要与
folddown
一起工作。我首先要获得一个数字,即,无论我们是6-9& 0还是1-5。然后我移动以查找使用
ifs ifs
来替换它的数字以获取所有情况。之后,我在3个案例中进行了另一个
ifs
条款,其中<> 0,< = 5,> 5。我终于将所有内容组合到一个单线中:= if(a1-Rounddown(a1,-1)<> 0,folddown(a1,-1)+ifs(a1-Rounddown(a1,-1) = 0,9,a1圈(a1,-1)< = 5,5,a1圈(a1,-1)> 5,9),a1-1)
希望这是可以理解的,并且有帮助。
Ok, this was a little tricky.I worked mostly with
rounddown
. I started by getting the ones number, i.e., whether we are 6-9&0 or 1-5.I then moved to find which number to replace it with using an
ifs
to get all the cases.Afterwards I ran another
ifs
clause for the 3 cases where <>0, <=5, >5. I finally combined everything into a one-liner:=if(A1-rounddown(A1,-1)<>0,rounddown(A1,-1)+IFS(A1-rounddown(A1,-1)=0,9,A1-rounddown(A1,-1)<=5,5,A1-rounddown(A1,-1)>5,9),A1-1)
Hopefully this was understandable and helpful.