建站优化

当前位置:

WPS四舍六入无成双怎么弄 ,wps四舍五入取整公式

浏览量:95次

WPS四舍六入无成双怎么弄 ,wps四舍五入取整公式

方法:先添加一个宏,然后起名。这里实例起名为MyRound

然后编辑宏弹出VBA编程窗口,在下面模块中输入:(系统生成的Sub Myround之类的全部删掉。)

Function myRound(ByVal num As Single, ByVal dec As Integer) As Single With Application.WorksheetFunction num = num * .Power(10, dec) num1 = .RoundDown(num, 0) num2 = num - num1 If num2 > 0.5 Or (num2 = 0.5 And Abs(num1 / 2 - Round(num1 / 2, 0)) > 0.00001) Then num1 = num1 + 1 num1 = num1 / .Power(10, dec) End With myRound = num1 End Function

保存后,然后在单元格中输入=myRound(单元格,小数点位数)即可

[声明]本网转载网络媒体稿件是为了传播更多的信息,此类稿件不代表本网观点,本网不承担此类稿件侵权行为的连带责任。故此,如果您发现本网站的内容侵犯了您的版权,请您的相关内容发至此邮箱【779898168@qq.com】,我们在确认后,会立即删除,保证您的版权。