首页 Win7教程 Win8教程 Win10教程 Excel教程 WPS教程 浏览器教程
当前位置: 首页 > excel > 详情

在Excel函数公式里面怎么把一个数字变成大写的

软件无忧 excel 2016-08-09

方法一:
Function 大写金额(N)
'数字转为大写金额,仅一个参数。
Application.Volatile
大写金额 = Replace(Application.Text(Round(N + 0.00000001, 2), "[DBnum2]"), ".", "元")
大写金额 = IIf(Left(Right(大写金额, 3), 1) = "元", Left(大写金额, Len(大写金额) - 1) & "角" & Right(大写金额, 1) & "分", IIf(Left(Right(大写金额, 2), 1) = "元", 大写金额 & "角整", IIf(大写金额 = "零", "", 大写金额 & "元整")))
大写金额 = Replace(Replace(Replace(Replace(大写金额, "零元零角", ""), "零元", ""), "零角", "零"), "-", "负")
End Function

将上面的自定义函数作为加载宏加载到你的EXCEL程序中,再插入函数“大写金额(N)”即可
方法二:
B1输入=IF(ROUND(A1,2)<0,"无效数值",IF(ROUND(A1,2)=0,"零",IF(ROUND(A1,2)<1,"",TEXT(INT(ROUND(A1,2)),"[dbnum2]")&"元")&IF(INT(ROUND(A1,2)*10)-INT(ROUND(A1,2))*10=0,IF(INT(ROUND(A1,2))*(INT(ROUND(A1,2)*100)-INT(ROUND(A1,2)*10)*10)=0,"","零"),TEXT(INT(ROUND(A1,2)*10)-INT(ROUND(A1,2))*10,"[dbnum2]")&"角")&IF((INT(ROUND(A1,2)*100)-INT(ROUND(A1,2)*10)*10)=0,"整",TEXT((INT(ROUND(A1,2)*100)-INT(ROUND(A1,2)*10)*10),"[dbnum2]")&"分")))