假如输入的小写金额在A1单元格,
公式:
=IF(A1=0,"",IF(INT(A1),TEXT(TRUNC(A1),"[dbnum2]")&"元","")&IF(MOD(A1,1)=0,"整",IF(TRUNC(A1,1),IF(A1=TRUNC(A1,1),TEXT(LEFT(RIGHT(A1*100,2)),"[dbnum2]0角整"),TEXT(RIGHT(A1*100,2),"[dbnum2]0"&IF(LEFT(RIGHT(A1*100,2))="0","","角")&"0分")),TEXT(A1*100,"[dbnum2]0分"))))
示例图片:
公式解释:
IF函数是用来逻辑判断,INT函数是取整,TEXT函数是将小写数字转换成中文大写格式,MOD函数是取余数(小数部分)。关于该系列函数的详细帮助及使用说明可以参阅Excel的帮助文件(打开Excel按下F1搜索相关函数即可)。
假设数字金额在A1,公式为
=TEXT(A1*100,"[dbnum2]0佰0拾0元角0分")
就是其中的0佰0拾什么的要自己调整的。
我这个简短些,角位是可以不写整的
=IF(OR(A1="",A1=0),"",TEXT(INT(A1),"[dbnum2]")&IF(INT(A1)=A1,"元整","元")&IF(INT(A1)<>A1,TEXT(--RIGHT(INT(A1*10)),"[=0]零;[>0][dbnum2]#角"),"")&TEXT(--RIGHT(INT(A1*100)),"[dbnum2]#分;;"))
=IF(ROUND(F33,2)<0,"无效数值",IF(ROUND(F33,2)=0,"零",IF(ROUND(F33,2)<1,"",TEXT(INT(ROUND(F33,2)),"[dbnum2]")&"元")&IF(INT(ROUND(F33,2)*10)-INT(ROUND(F33,2))*10=0,IF(INT(ROUND(F33,2))*(INT(ROUND(F33,2)*100)-INT(ROUND(F33,2)*10)*10)=0,"","零"),TEXT(INT(ROUND(F33,2)*10)-INT(ROUND(F33,2))*10,"[dbnum2]")&"角")&IF((INT(ROUND(F33,2)*100)-INT(ROUND(F33,2)*10)*10)=0,"整",TEXT((INT(ROUND(F33,2)*100)-INT(ROUND(F33,2)*10)*10),"[dbnum2]")&"分")))
给两个公式你选择:
=IF(ISERROR(FIND(".",A1)),NUMBERSTRING(INT(A1),2)&"元整",IF(ISERROR(NUMBERSTRING(MID(A1,FIND(".",A1)+2,1),2)),NUMBERSTRING(INT(A1),2)&"元"&NUMBERSTRING(MID(A1,FIND(".",A1)+1,1),2)&"角整",NUMBERSTRING(INT(A1),2)&"元"&NUMBERSTRING(MID(A1,FIND(".",A1)+1,1),2)&"角"&NUMBERSTRING(MID(A1,FIND(".",A1)+2,1),2)&"分"))
------------------------------------------------------
=IF((A1-INT(A1))=0,TEXT(A1,"[DBNUM2]")&"元整",IF(INT(A1*10)-A1*10=0,TEXT(INT(A1),"[DBNUM2]")&"元"&TEXT((INT(A1*10)-INT(A1)*10),"[DBNUM2]")&"角整",TEXT(INT(A1),"[DBNUM2]")&"元"&IF(INT(A1*10)-INT(A1)*10=0,"零",TEXT(INT(A1*10)-INT(A1)*10,"[DBNUM2]")&"角")&TEXT(RIGHT(A1,1),"[DBNUM2]")&"分"))