excel 中如何实现x的四舍六入五成双到小数点n位?
时间:2023-07-10 06:52:00
可以在excel中建立宏,然后输入以下程序:
Function Roundx(x, n)
y = x * 10 ^ n - Int(x * 10 ^ n)
z = Int(x * 10 ^ n)
If y >= 0.6 Then
p = (Int(x * 10 ^ n) + 1) / 10 ^ n
ElseIf y < 0.5 Then
p = Int(x * 10 ^ n) / 10 ^ n
ElseIf z / 2 = z \ 2 Then
p = Int(x * 10 ^ n) / 10 ^ n
ElseIf z / 2 <> z \ 2 Then
p = (Int(x * 10 ^ n) + 1) / 10 ^ n
End If
Roundx = p
End Function
当n为正,则为小数点之后,n为负,则小数点之前。
标签:excel,中如何实现x的四舍六入五成双到小数点n位?
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
新浪微博怎么取消图片水印?新浪微博关闭图片水印的方法
2023-11-25 23:19:20
![](https://img.aspxhome.com/file/2023/8/a339740_0s.jpg)
如何安装Win11系统KB5004252补丁?
2022-02-27 23:23:55
![](https://img.aspxhome.com/file/2023/27/a238491_0s.png)
yearfrac函数的使用方法
2023-03-22 18:40:06
![](https://img.aspxhome.com/file/2023/3/a161443_0s.png)
wps怎么设计特价宣传卡通图标? wps特惠标签的画法
2022-08-12 01:32:30
![](https://img.aspxhome.com/file/2023/4/a165884_0s.jpg)
mwd.exe - mwd是什么进程 有什么用
2022-08-30 09:12:34
Win7修改SearchIndexer数据位置节省C盘空间方法
2023-11-19 09:26:33
![](https://img.aspxhome.com/file/2023/27/a230346_0s.jpg)
如何使用WPS里的听文档功能,将文字转为语音
2022-04-01 13:23:02
![](https://img.aspxhome.com/file/2023/6/a184516_0s.jpg)
Win7 IE提示当前安全设置不允许下载该文件的解决方法
2023-08-12 00:49:12
![](https://img.aspxhome.com/file/2023/27/a232101_0s.jpg)
oracle11g数据库安装使用教程
2023-05-25 05:33:59
![](https://img.aspxhome.com/file/2023/4/a312849_0s.jpg)
win10如何彻底删除2345主页?
2023-09-25 13:35:00
![](https://img.aspxhome.com/file/2023/1/a272650_0s.png)
Win7任务管理器窗口显示不全怎么解决?
2022-04-28 23:09:04
![](https://img.aspxhome.com/file/2023/1/a280546_0s.jpg)
ThinkPad neo 14怎么重装系统?ThinkPad neo 14重装系统的教程
2023-05-24 18:35:15
如何使用Compressor预设值压制项目,Compressor使用教程
2022-04-23 03:13:21
![](https://img.aspxhome.com/file/2023/6/a213726_0s.jpeg)
苹果中国营收大跌!投资者神吐槽:Note 7都炸了
2022-08-23 00:54:09
![](https://img.aspxhome.com/file/2023/2/a288758_0s.jpg)
win10版本1903怎么关闭自带杀毒
2023-11-08 09:28:57
![](https://img.aspxhome.com/file/2023/7/48207_0s.jpg)
excel表格筛选后求和的方法
2023-11-28 11:00:49
Excel打不开文件怎么办?Excel打不开文件的解决方法
2022-01-20 15:09:08
![](https://img.aspxhome.com/file/2023/8/a153238_0s.png)
如何把握PPT整体配色风格
2022-03-10 12:46:02
Steam安装后是英文的怎么办 Steam语言设置中文的方法
2023-03-05 18:10:21
![](https://img.aspxhome.com/file/2023/2/a284474_0s.jpg)
Win10提示照片查看器内存不足怎么办?Win10提示照片查看器内存不足的解决方法
2022-11-15 22:45:19
![](https://img.aspxhome.com/file/2023/26/a219388_0s.jpg)