资源描述:
《excel中将表示金额的阿拉伯数字转换成中文大写的方法》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、excel中怎么将表示金额的阿拉伯数字转换成中文大写1、假设数字在A1单元格,目标单元格公式:=SUBSTITUTE(SUBSTITUTE(IF(ISNUMBER(FIND(".",A1)),TEXT(LEFT(A1,FIND(".",A1)-1),"[dbnum2]")&"元"&TEXT(MID(A1,FIND(".",A1)+1,1),"[dbnum2]")&"角"&TEXT(MID(A1,FIND(".",A1)+2,1),"[dbnum2]")&"分",TEXT(A1,"[dbnum2]")&
2、"元整"),"角分","角整"),"-","负")2、要结果的单元格输入公式=IF(A2<0,"负","")&TEXT(TRUNC(ABS(ROUND(A2,2))),"[DBNum2]")&"元"&IF(ISERR(FIND(".",ROUND(A2,2))),"",TEXT(RIGHT(TRUNC(ROUND(A2,2)*10)),"[DBNum2]"))&IF(ISERR(FIND(".0",TEXT(A2,"0.00"))),"角","")&IF(LEFT(RIGHT(ROUND(A2,2),
3、3))=".",TEXT(RIGHT(ROUND(A2,2)),"[DBNum2]")&"分","整"),A2是数字格。3、打开Excel,按Alt+F11或者选择菜单工具→宏→VisualBasic编辑器进入后新建模块(插入→模块),键入以下语句:FunctionNCN(account)'NummaryCapitalNumberybb=Round(account*100)y=Int(ybb/100)j=Int(ybb/10)-y*10f=ybb-y*100-j*10zy=Application.Wo
4、rksheetFunction.Text(y,"[dbnum2]")zj=Application.WorksheetFunction.Text(j,"[dbnum2]")zf=Application.WorksheetFunction.Text(f,"[dbnum2]")NCN=zy&"圆"Ifj=0Andf=0ThenNCN=NCN&"整"EndIfIff<>0Andj<>0ThenNCN=NCN&zj&"角"&zf&"分"Ify=0ThenNCN=zj&"角"&zf&"分"EndIfEndIfIf
5、f=0Andj<>0ThenNCN=NCN&zj&"角"Ify=0ThenNCN=zj&"角"EndIfEndIfIff<>0Andj=0ThenNCN=NCN&zj&zf&"分"Ify=0ThenNCN=zf&"分"EndIfEndIfIfaccount=""ThenNCN=""EndIfEndFunction这样就可以了,关闭VB编辑器,进入Excel界面会发现在插入函数时多了一类“用户定义”,里面有个函数“NCN”,意思是“NummaryCapitalNumber”货币大写数字。如果不喜欢,可以
6、在角本里改,用理想的函数名替换"NCN"即可。关闭之前可以把你自己写的模块导出到一个.bas文件,以后想用的时候导入即可。因为是自己编写的,所以没有数字签名,打开带有此函数的文件时会提示有风险。降低安全级别即可,打开之后再改回来。4、=SUBSTITUTE(IF(A2,IF(A2<0,"负",)&TEXT(TRUNC(A2),"[dbnum2]g/通用格式元;[dbnum2]g/通用格式元;")&TEXT(RIGHT(RMB(A2),2),"[>9][dbnum2]0角0分;[>0][dbnum2]0
7、0分;整"),"零元"),"零分","整")