乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > EXCEL函数如何将数字转化成英文大写金额?-excel英文金额大写金额,excel自动大写金额

EXCEL函数如何将数字转化成英文大写金额?-excel英文金额大写金额,excel自动大写金额

作者:乔山办公网日期:

返回目录:excel表格制作




使用自定义函数

步骤:ALT+F11,插入模块,复制下方代码7a686964616fe59b9ee7ad94361

然后在需要使用的地方输入公式:=SpellNumber(单元格地址)

效果图如下,B1公式为=SpellNumber(A1)

Function SpellNumber(ByVal MyNumber)

    Dim Dollars, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Application.Volatile True
    Place(2) = " THOUSAND "
    Place(3) = " MILLION "
    Place(4) = " BILLION "
    Place(5) = " TRILLION "
    MyNumber = Trim(Str(MyNumber))
    DecimalPlace = InStr(MyNumber, ".")
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
        End If
    Count = 1
    Do While MyNumber <> ""
       Temp = GetHundreds(Right(MyNumber, 3))
       If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
          If Len(MyNumber) > 3 Then
             MyNumber = Left(MyNumber, Len(MyNumber) - 3)
             Else
            MyNumber = ""
            End If
            Count = Count + 1
            Loop
    Select Case Dollars
        Case ""
            Dollars = ""
        Case "One"
            Dollars = "One Dollar"
        Case Else
            Dollars = "US DOLLARS " & Dollars
    End Select
    SpellNumber = Dollars
    End Function
Function GetHundreds(ByVal MyNumber)
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " HUNDRED "
        End If
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & GetTens(Mid(MyNumber, 2))
        Else
        Result = Result & GetDigit(Mid(MyNumber, 3))
        End If
    GetHundreds = Result
    End Function
Function GetTens(TensText)
    Dim Result As String
    Result = ""
    If Val(Left(TensText, 1)) = 1 Then
        Select Case Val(TensText)
        Case 10: Result = "Ten"
            Case 11: Result = "ELEVEN"
            Case 12: Result = "TWELVE"
            Case 13: Result = "THIRTEEN"
            Case 14: Result = "FOURTEEN"
            Case 15: Result = "FIFTEEN"
            Case 16: Result = "SIXTEEN"
            Case 17: Result = "SEVENTEEN"
            Case 18: Result = "EIGHTEEN"
            Case 19: Result = "NINETEEN"
            Case Else
            End Select
      Else
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "AND TWENTY "
            Case 3: Result = "AND THIRTY "
            Case 4: Result = "AND FORTY "
            Case 5: Result = "AND FIFTY "
            Case 6: Result = "AND SIXTY "
            Case 7: Result = "AND SEVENTY "
            Case 8: Result = "AND EIGHTY "
            Case 9: Result = "AND NINETY "
            Case Else
        End Select
         Result = Result & GetDigit _
            (Right(TensText, 1))
            End If
      GetTens = Result
      End Function
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "ONE"
        Case 2: GetDigit = "TWO"
        Case 3: GetDigit = "THREE"
        Case 4: GetDigit = "FOUR"
        Case 5: GetDigit = "FIVE"
        Case 6: GetDigit = "SIX"
        Case 7: GetDigit = "SEVEN"
        Case 8: GetDigit = "EIGHT"
        Case 9: GetDigit = "NINE"
        Case Else: GetDigit = ""
    End Select
End Function

下面这个你拿去用吧!
="合计人民币(大写)"&SUBSTITUTE(SUBSTITUTE(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))=".",TEXT(RIGHT(ROUND(A2,2)),"[DBNum2]")&"分",IF(ROUND(A2,2)=0,"","整")),"零元零",""),"零元","")

当然你如果只是想在电子表格的数字实行小写变大写!不要加元角分的话,你只要在单元格格式里的”7a686964616fe78988e69d83362特殊”中选中”中文大写数字”
步骤是:”格式”->”单元格”->”数字”->”特殊”->”中文大写数字”

下面帮助理解:
要将人民币小写金额转换成大写格式,用Excel提供的格式,将自定义格式类型中的“[dbnum2]G/通用格式”改为“[dbnum2] G/通用格式“元””来实现。但在转换小数时却出现了问题,比如¥6,050.09只能转换为“陆仟零伍拾.零玖圆”。那么用Excel能不能解决这一先天不足呢?其方法有以下两种(以下均对B1转换,假设B1是通过函数ROUND( )四舍五入取得二位小数的小写金额数,其值为¥6,050.09)。

一、在三个连续的同行单元格中转换

1. B2中输入公式 “=IF(B1〈0,"金额为负无效",INT(B1))”,计算结果为¥6,050.00,然后点击“格式→单元格→数字→特殊→中文大写数字→确定”,B2显示“陆仟零伍拾”,再点击“格式→单元格→数字→自定义”,将“类型”编辑框中的“[dbnum2]G/通用格式”修改为:[dbnum2](“人民币”)G/通用格式“元”,此时B2显示:“(人民币)陆仟零伍拾元”。

2. C2中输入“=IF(B1〈0,"",INT(B1

使用数字转英文货币大写“自定义函数”,具体使用方法如下:

所需材料:Excel、数字转英文货币大写自定义函数(可通过网络复制粘贴)。

一、首先打开Excel表格文件,按Alt+F11打开VBA窗口,插入一个“模块”。

二、右键模块1,菜单内点击“导入文件”。

三、找到数字转大写英文货币的BAS格式文件,点击“打开”。

四、这时就可以把该函数导入VBA模块,另外如果是通过网格上粘贴的数字转英文大写金额函数,则真可以在下图白色区域内Ctrl+V粘贴进来即可,导入函数后,关闭VBA窗口。

五、这时在数字单元格右边单元格内输入=SpellNumber(A1),按回车键即可得出大写英文金额,其它单元格下拉填充即可。

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网