您的位置首页百科问答

excel表格去掉小数点

excel表格去掉小数点

VBA 代码Function REMOVEPOINT(ByVal Number As Double) As Double Do While Number <> Int(Number) Number = Number * 10 Loop REMOVEPOINT = NumberEnd Function然后在单元格中输烂激入=REMOVEPOINT(3.145)但是用浮点数计算不免会有精度误差,所以最好用这种方饥扰袜法:Function REMOVEPOINT(ByVal Str As String) As String REMOVEPOINT = Replace(Str, ".", "")End Function然后在单元格中输入=REMOVEPOINT("3.145")或=REMOVEPOINT(3.145)都行,就是要注意返回的是字李慎符串 "3145"