电脑教程
位置:首页>> 电脑教程>> WPS教程>> WPS四舍六入无成双怎么弄?

WPS四舍六入无成双怎么弄?

  发布时间:2023-12-01 13:29:24 

标签: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(单元格,小数点位数)即可

WPS四舍六入无成双怎么弄?

0
投稿

猜你喜欢

手机版 电脑教程 asp之家 www.aspxhome.com