excel金額大小寫轉(zhuǎn)換公式的用法
excel金額大小寫轉(zhuǎn)換公式的用法
Excel中經(jīng)常需要使用到金額大小寫轉(zhuǎn)換公式對金額進行轉(zhuǎn)換,金額大小寫轉(zhuǎn)換公式具體該如何使用呢?接下來是學習啦小編為大家?guī)淼膃xcel金額大小寫轉(zhuǎn)換公式的用法,供大家參考。
excel金額大小寫轉(zhuǎn)換公式用法(一)
步驟1:數(shù)字轉(zhuǎn)人民幣大寫形式的公式是:
=IF(B1<0,"金額為負無效",
(IF(OR(B1=0,B1=""),"(人民幣)零元",
IF(B1<1,"(人民幣)",
TEXT(INT(B1),"[dbnum2](人民幣)G/通用格式")&"元"))))&
IF(
(INT(B1*10)-INT(B1)*10)=0,
IF(INT(B1*100)-INT(B1*10)*10=0,"","零"),
(TEXT(INT(B1*10)-INT(B1)*10,"[dbnum2]")&"角"))
&IF(
(INT(B1*100)-INT(B1*10)*10)=0,
"整",
TEXT((INT(B1*100)-INT(B1*10)*10),"[dbnum2]")&"分")
步驟2:數(shù)字轉(zhuǎn)人民幣大寫形式的公式是:
="大寫金額:"&IF(TRIM(B1)="","",IF(B1=0,"","人民幣"&IF(B1<0,"負",)&IF(INT(B1),TEXT(INT(ABS(B1)),"[dbnum2]")&"元",)&IF(INT(ABS(B1)*10)-INT(ABS(B1))*10,TEXT(INT(ABS(B1)*10)-INT(ABS(B1))*10,"[dbnum2]")&"角",IF(INT(ABS(B1))=ABS(B1),,IF(ABS(B1)<0.1,,"零")))&IF(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),TEXT(ROUND(ABS(B1)*100-INT(ABS(B1)*10)*10,),"[dbnum2]")&"分","整")))
excel金額大小寫轉(zhuǎn)換公式用法(二)
步驟1:通過宏VBA自定義函數(shù)實現(xiàn)第一步:按下ALT+F11組合鍵,或者是單擊工具——宏——Visual Basic編輯器,進入Visual Basic編程環(huán)境,單擊“插入” 菜單——模塊,復(fù)制下面代碼,保存,退出關(guān)閉。Function N2RMB(M)
y = Int(Round(100 * Abs(M)) / 100)
j = Round(100 * Abs(M) + 0.00001) - y * 100
f = (j / 10 - Int(j / 10)) * 10
A = IIf(y < 1, "", Application.Text(y, "[DBNum2]") & "元")
b = IIf(j > 9.5, Application.Text(Int(j / 10), "[DBNum2]") & "角", IIf(y < 1, "", IIf(f > 1, "零", "")))
c = IIf(f < 1, "整", Application.Text(Round(f, 0), "[DBNum2]") & "分")
N2RMB = IIf(Abs(M) < 0.005, "", IIf(M < 0, "負" & A & b & c, A & b & c))
End Function
步驟2:返回excel操作界面,在B1單元格輸入:= N2RMB (A1),就可以將A1單元格的數(shù)字轉(zhuǎn)為人民幣大寫,然后向下復(fù)制公式即可將全部的數(shù)字轉(zhuǎn)為人民幣大寫。