|
公式:
=IF(OR(ROUND(B14,2)=0,ROUND(B14,2)=""),"零元整",IF(ROUND(B14,2)<1,"",TEXT(INT(ROUND(B14,2)),"[dbnum2]G/通用格式")&"元")&IF(INT(ROUND(B14,2))-ROUND(B14,2)=0,"整",TEXT(INT(ROUND(B14,2)*10)-INT(ROUND(B14,2))*10,"[dbnum2]")&IF(INT(ROUND(B14,2)*10)-INT(ROUND(B14,2))*10=0,"","角")&IF(INT(ROUND(B14,2)*100)-INT(ROUND(B14,2)*10)*10=0,"整",TEXT(INT(ROUND(B14,2)*100)-INT(ROUND(B14,2)*10)*10,"[dbnum2]")&"分")))
或者代码:
<COLGROUP>
<COL style="WIDTH: 669pt; mso-width-source: userset; mso-width-alt: 28544" width=892>
Function NtoC(n) 'n as single
Const cNum = "零壹贰叁肆伍陆柒捌玖-万仟佰拾亿仟佰拾万仟佰拾元角分"
Const cCha = "零仟零佰零拾零零零零零亿零万零元亿万零角零分零整-零零零零零亿万元亿零整整"
NtoC = ""
sNum = Trim(Str(Int(n * 100)))
For i = 1 To Len(sNum) '逐位转换
NtoC = NtoC + Mid(cNum, (Mid(sNum, i, 1)) + 1, 1) + Mid(cNum, 26 - Len(sNum) + i, 1)
Next
For i = 0 To 11 '去掉多余的零
NtoC = Replace(NtoC, Mid(cCha, i * 2 + 1, 2), Mid(cCha, i + 26, 1))
Next
End Function
|
|