金额大写的转换
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
公式法三:
=CONCATENATE(TEXT(INT(A1),"[DBNum2][$-804]G/通用格式")&"元"&IF((INT(A1*10) -INT(A1)*10)=0,"",TEXT(IF(AND(CEILING(A1*100,1)-INT(A1*10)*10=10,INT(A1*1000)-INT(A1*100)*10>=5),INT(A1*10)-INT(A1)*10 1,INT(A1*10)-INT(A1)*10),"[DBNum2][$-804]G/通用格式")&"角")&IF(OR(INT(A1*100)-INT(A1*10)*10=0,(IF(INT(A1*1000)-INT(A1*100)*10>=5,CEILING(A1* 100,1)-INT(A1*10)*10=10,FALSE))),"整",(IF(INT(A1*1000)-INT(A1*100)*10>=5,(IF(CEILING(A1 *100,1)-INT(A1*10)*10=10,"",(TEXT(CEILING(A1*100,1)-INT(A1*10)*10,"[DBNum2][$-804]G/通用格式")&"分"))),(TEXT(INT(A1*100)-INT(A1*10)*10,"[DBNum2][$-804]G/通用格式")&"分")))),"(¥",FIXED(A1,2,TRUE),"元)")
四、VBA代码法(自定义函数)
Public Function BigNum(xiaoxie As Currency)
Application.Volatile
Dim fuhao As String
fuhao = ""
If xiaoxie < 0 Then
xiaoxie = -xiaoxie
fuhao = "负"
For i = 1 To Len(sNum)
BigNum = BigNum Mid(cNum, (Mid(sNum, i, 1)) 1, 1) Mid(cNum, 26 - Len(sNum) i, 1)
Next i
For i = 0 To 11
BigNum = Replace(BigNum, Mid(cCha, i * 2 1, 2), Mid(cCha, i 26, 1))
End If
If xiaoxie = 0 Then
BigNum = "零元整"
Else
Const cNum = "零壹贰叁肆伍陆柒捌玖-万仟佰拾亿仟佰拾万仟佰拾元角分"
Const cCha = "零仟零佰零拾零零零零零亿零万零元亿万零角零分零整-零零零零零亿万元亿零整整"
BigNum = ""
sNum = Trim(Str(Int(Round(xiaoxie, 2) * 100)))
Next i
BigNum = fuhao BigNum
End If
End Function
上面四种办法中,方法一和方法四等价;方法二、三和方法一、四的区别只是整数部分为零时,方法一、四不显示“零元”,而直接显示“角分”;方法三在方法2的基础上加上了数字显示,下表是不同数据在四种方法中的显示结果:
原始数据
零元整
-25001
负贰万伍仟零壹元整
负贰万伍仟零壹元整
-贰万伍仟零壹元整(¥-25001.00元)
负贰万伍仟零壹元整
公式法二:
=IF(A1<0,"负",)&TEXT(TRUNC(ABS(A1)),"[DBNum2]G/通用格式")&"元"&IF(ROUND(A1,3) =ROUND(A1,),"整",TEXT(RIGHT(TRUNC(A1*10),1),"[DBNum2]G/通用格式")&"角"&IF (ROUND(A1,3)=ROUND(A1,1),"整",TEXT(RIGHT(ROUND((A1*100),),1),"[DBNum2]G/通用格式")&"分"))
方法一
方法二
方法三
方法四
0.12
壹角贰分
零元壹角贰分
零元壹角贰分(¥0.12元)
壹角贰分
1.02
壹元零贰分
壹元零角贰分
壹元贰分(¥1.02元)
壹元零贰分
1001001
壹佰万壹仟零壹元整
壹佰万壹仟零壹元整
壹佰万壹仟零壹元整(¥1001001.00元)
壹佰万壹仟零壹元整
0
零元整
零元整
零元整(¥0.00元)Baidu Nhomakorabea
金额大写的转换
假设A1单元格为原始数据,即小写数字。
公式法一:
=IF(A1=0,"零元整",IF(A1<0,"负",)&IF(INT(ABS(A1)),TEXT(INT(ABS(A1)),"[dbnum2]")&"元",)&IF(INT(ABS(A1)*10)-INT(ABS(A1))*10,TEXT(INT(ABS(A1)*10)-INT(ABS(A1))*10,"[dbnum2]")&"角",IF(INT(ABS(A1))=ABS(A1),,"零"))&IF(ROUND(ABS(A1)*100-INT(ABS(A1)*10)* 10,) , TEXT(ROUND(ABS(A1)*100-INT(ABS(A1)*10)*10,),"[dbnum2]")&"分","整"))
=CONCATENATE(TEXT(INT(A1),"[DBNum2][$-804]G/通用格式")&"元"&IF((INT(A1*10) -INT(A1)*10)=0,"",TEXT(IF(AND(CEILING(A1*100,1)-INT(A1*10)*10=10,INT(A1*1000)-INT(A1*100)*10>=5),INT(A1*10)-INT(A1)*10 1,INT(A1*10)-INT(A1)*10),"[DBNum2][$-804]G/通用格式")&"角")&IF(OR(INT(A1*100)-INT(A1*10)*10=0,(IF(INT(A1*1000)-INT(A1*100)*10>=5,CEILING(A1* 100,1)-INT(A1*10)*10=10,FALSE))),"整",(IF(INT(A1*1000)-INT(A1*100)*10>=5,(IF(CEILING(A1 *100,1)-INT(A1*10)*10=10,"",(TEXT(CEILING(A1*100,1)-INT(A1*10)*10,"[DBNum2][$-804]G/通用格式")&"分"))),(TEXT(INT(A1*100)-INT(A1*10)*10,"[DBNum2][$-804]G/通用格式")&"分")))),"(¥",FIXED(A1,2,TRUE),"元)")
四、VBA代码法(自定义函数)
Public Function BigNum(xiaoxie As Currency)
Application.Volatile
Dim fuhao As String
fuhao = ""
If xiaoxie < 0 Then
xiaoxie = -xiaoxie
fuhao = "负"
For i = 1 To Len(sNum)
BigNum = BigNum Mid(cNum, (Mid(sNum, i, 1)) 1, 1) Mid(cNum, 26 - Len(sNum) i, 1)
Next i
For i = 0 To 11
BigNum = Replace(BigNum, Mid(cCha, i * 2 1, 2), Mid(cCha, i 26, 1))
End If
If xiaoxie = 0 Then
BigNum = "零元整"
Else
Const cNum = "零壹贰叁肆伍陆柒捌玖-万仟佰拾亿仟佰拾万仟佰拾元角分"
Const cCha = "零仟零佰零拾零零零零零亿零万零元亿万零角零分零整-零零零零零亿万元亿零整整"
BigNum = ""
sNum = Trim(Str(Int(Round(xiaoxie, 2) * 100)))
Next i
BigNum = fuhao BigNum
End If
End Function
上面四种办法中,方法一和方法四等价;方法二、三和方法一、四的区别只是整数部分为零时,方法一、四不显示“零元”,而直接显示“角分”;方法三在方法2的基础上加上了数字显示,下表是不同数据在四种方法中的显示结果:
原始数据
零元整
-25001
负贰万伍仟零壹元整
负贰万伍仟零壹元整
-贰万伍仟零壹元整(¥-25001.00元)
负贰万伍仟零壹元整
公式法二:
=IF(A1<0,"负",)&TEXT(TRUNC(ABS(A1)),"[DBNum2]G/通用格式")&"元"&IF(ROUND(A1,3) =ROUND(A1,),"整",TEXT(RIGHT(TRUNC(A1*10),1),"[DBNum2]G/通用格式")&"角"&IF (ROUND(A1,3)=ROUND(A1,1),"整",TEXT(RIGHT(ROUND((A1*100),),1),"[DBNum2]G/通用格式")&"分"))
方法一
方法二
方法三
方法四
0.12
壹角贰分
零元壹角贰分
零元壹角贰分(¥0.12元)
壹角贰分
1.02
壹元零贰分
壹元零角贰分
壹元贰分(¥1.02元)
壹元零贰分
1001001
壹佰万壹仟零壹元整
壹佰万壹仟零壹元整
壹佰万壹仟零壹元整(¥1001001.00元)
壹佰万壹仟零壹元整
0
零元整
零元整
零元整(¥0.00元)Baidu Nhomakorabea
金额大写的转换
假设A1单元格为原始数据,即小写数字。
公式法一:
=IF(A1=0,"零元整",IF(A1<0,"负",)&IF(INT(ABS(A1)),TEXT(INT(ABS(A1)),"[dbnum2]")&"元",)&IF(INT(ABS(A1)*10)-INT(ABS(A1))*10,TEXT(INT(ABS(A1)*10)-INT(ABS(A1))*10,"[dbnum2]")&"角",IF(INT(ABS(A1))=ABS(A1),,"零"))&IF(ROUND(ABS(A1)*100-INT(ABS(A1)*10)* 10,) , TEXT(ROUND(ABS(A1)*100-INT(ABS(A1)*10)*10,),"[dbnum2]")&"分","整"))