假设你的金额存放在I5,在你要显示大写金额的单元格内输入以下公式:
=IF(TRUNC(I5)=I5,TEXT(TRUNC(I5),"[dbnum2]G/通用格式"&"元整"),IF(TRUNC(ROUND((I5-INT(I5))*10,2))=ROUND((I5-INT(I5))*10,2),TEXT(TRUNC(I5),"[dbnum2]G/通用格式"&"元")&TEXT(TRUNC(ROUND((I5-INT(I5))*10,2)),"[dbnum2]G/通用格式"&"角整"),TEXT(TRUNC(I5),"[dbnum2]G/通用格式"&"元")&TEXT(TRUNC(ROUND((I5-INT(I5))*10,2)),"[dbnum2]G/通用格式"&"角")&TEXT((ROUND((I5-INT(I5))*10,2)-TRUNC(ROUND((I5-INT(I5))*10,2)))*10,"[dbnum2]G/通用格式"&"分")))
(如果你的小写金额在其他单元格内[如A1],可以用A1把I5替换掉就行了)
=SUBSTITUTE(SUBSTITUTE(TEXT(TRUNC(FIXED(A1)),"[>0][dbnum2];[<0]负[dbnum2];;")&TEXT(RIGHT(FIXED(A1),2),"元[dbnum2]0角0分;;"&IF(ABS(A1)>1%,"元整",)),"零角",IF(ABS(A1)<1,,"零")),"零分","整")
假设你的数值在a1,则放结果的单元格
=TEXT(INT(A1),"[dbnum2]")&IF(INT(A1)=A1,"元整","元")&IF(ISERROR(FIND(".",A1))=TRUE,"",IF(LEN(A1)-FIND(".",A1)=1,TEXT(RIGHT(A1,1),"[dbnum2]")&"角",IF(AND(LEN(A1)-FIND(".",A1)=2,MID(A1,LEN(A1)-1,1)<>"0"),TEXT(MID(A1,LEN(A1)-1,1),"[dbnum2]")&"角"&TEXT(RIGHT(A1,1),"[dbnum2]")&"分","零"&TEXT(RIGHT(A1,1),"[dbnum2]")&"分")))
a