这个要将一段自定义DX()函数的代码放到你的EXCWL文档中,并启用才行。我这有一段代码,你试试。
Function dx(q)
ybb = Round(q * 100) '将输入的数值扩大100倍,进行四舍五入
y = Int(ybb / 100) '截取出整数部分
j = Int(ybb / 10) - y * 10 '截取出十分位
f = ybb - y * 100 - j * 10 '截取出百分位
zy = Application.WorksheetFunction.Text(y, "[dbnum2]") '将整数部分转为中文大写
zj = Application.WorksheetFunction.Text(j, "[dbnum2]") '将十分位转为中文大写
zf = Application.WorksheetFunction.Text(f, "[dbnum2]") '将百分位转为中文大写
dxje = zy & "元" & "整"
d1 = zy & "元"
If f <> 0 And j <> 0 Then
dxje = d1 & zj & "角" & zf & "分"
If y = 0 Then
dxje = zj & "角" & zf & "分"
End If
End If
If f = 0 And j <> 0 Then
dxje = d1 & zj & "角" & "整"
If y = 0 Then
dxje = zj & "角" & "整"
End If
End If
If f <> 0 And j = 0 Then
dxje = d1 & zj & zf & "分"
If y = 0 Then
dxje = zf & "分"
End If
End If
If q = "" Then
dxje = 0 '如没有输入任何数值为0
End If
End Function
居然没分?
为什么一定要用dx,给你个公式=TEXT(INT(A1),"[dbnum2]")&"元"&IF(INT(A1*10)-INT(A1)*10=0,"",TEXT(INT(A1*10)-INT(A1)*10,"[dbnum2]")&"角")&IF(INT(A1*100)-INT(A1*10)*10=0,"整",TEXT(INT(A1*100)-INT(A1*10)*10,"[dbnum2]")&"分"),用这个就行了