Excel数字大写转换

更新时间:2023-05-18 13:36:39 阅读: 评论:0

1.阿拉伯数字转换中文大写。
=IF((A7-INT(A7))=0,TEXT(A7,"[DBNUM2]")&"元整",IF(INT(A7*10)-A7*10=0,TEXT(INT(A7),"[DBNUM2]")&"元"&TEXT((INT(A7*10)-INT(A7)*10),"[DBNUM2]")&"角整",TEXT(INT(A7),"[DBNUM2]")&"元"&IF(INT(A7*10)-INT(A7)*10=0,"零",TEXT(INT(A7*10)-INT(A7)*10,"[DBNUM2]")&"角")&TEXT(RIGHT(A7,1),"[DBNUM2]")&"分"))
该函数中只需将A7换成你要转换的数值所在单元格即可。
2.阿拉伯数字转换英文大写(编写SpellNumber实例函数)
2.1 启动 Microsoft Excel
2.2   Alt+F11 enzyme启动 Visual Basic 编辑器。
2.3   插入菜单上,单击模块
2.4   在模块表中键入下面的代码。
在线英汉翻译Function ConvertCurrencyToEnglish(ByVal MyNumber)
          Dim Temp
          Dim Dollars, Cents
          Dim DecimalPlace, Count
          ReDim Place(9) As String
          Place(2) = " Thousand "
          Place(3) = " Million "
          Place(4) = " Billion "
zax          Place(5) = " Trillion "
          ' Convert MyNumber to a string, trimming extra spaces.
          MyNumber = Trim(Str(Round(MyNumber, 2)))
          ' Find decimal place.
          DecimalPlace = InStr(MyNumber, ".")
          ' If we find
          If DecimalPlace > 0 Then
            ' Convert cents
            Temp = Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2)
            Cents = ConvertTens(Temp)
            ' Strip off cents from remainder to convert.
            MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
          End If
          Count = 1
          Do While MyNumber <> ""
            ' Convert last 3 digits of MyNumber to English dollars.
            Temp = ConvertHundreds(Right(MyNumber, 3))
            If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
            If Len(MyNumber) > 3 Then
                ' Remove last 3 converted digits from MyNumber.
                MyNumber = Left(MyNumber, Len(MyNumber) - 3)
            El
                MyNumber = ""queen是什么意思
            End If
            Count = Count + 1
          Loop
          ' Clean up dollars.
          Select Ca Dollars
            Ca ""
                Dollars = "No Dollars"
            Ca "One"
                Dollars = "One Dollar"
            Ca El
                Dollars = Dollars & " Dollars"
          End Select
          ' Clean up cents.
          Select Ca Cents
            Ca ""
                Cents = " Only"
            Ca "One"
                Cents = " And One Cent"
            Ca El
                Cents = " And " & Cents & " Cents"
          End Select
爱荷华大学          ConvertCurrencyToEnglish = Dollars & Cents
      End Function
      Private Function ConvertHundreds(ByVal MyNumber)
          Dim Result As String
          ' Exit if there is nothing to convert.
          If Val(MyNumber) = 0 Then Exit Function
          ' Append leading zeros to number.
          MyNumber = Right("000" & MyNumber, 3)
          ' Do we have a hundreds place digit to convert?
          If Left(MyNumber, 1) <> "0" Then
            If Right("000" & MyNumber, 2) <> 0 Then
            Result = ConvertDigit(Left(MyNumber, 1)) & " Hundred and "
            El
            Result = ConvertDigit(Left(MyNumber, 1)) & " Hundred "
            End If
        End If
          ' Do we have a tens place digit to convert?
          If Mid(MyNumber, 2, 1) <> "0" Then
广场的拼音            Result = Result & ConvertTens(Mid(MyNumber, 2))
          El
            ' If not, then convert the ones place digit.
            Result = Result & ConvertDigit(Mid(MyNumber, 3))
          End If
          ConvertHundreds = Trim(Result)
      End Function
      Private Function ConvertTens(ByVal MyTens)
          Dim Result As String
          ' Is value between 10 and 19?
          If Val(Left(MyTens, 1)) = 1 Then
            Select Ca Val(MyTens)
                Ca 10: Result = "Ten"
                Ca 11: Result = "Eleven"
                Ca 12: Result = "Twelve"
nlc                Ca 13: Result = "Thirteen"
veritas                Ca 14: Result = "Fourteen"
                Ca 15: Result = "Fifteen"
                Ca 16: Result = "Sixteen"
                Ca 17: Result = "Seventeen"
crayon中文音译                Ca 18: Result = "Eighteen"
                Ca 19: Result = "Nineteen"
                Ca El
            End Select
          El
            ' .. otherwi it's between 20 and 99.
            Select Ca Val(Left(MyTens, 1))
                Ca 2: Result = "Twenty"
                Ca 3: Result = "Thirty"
                Ca 4: Result = "Forty"
                Ca 5: Result = "Fifty"
                Ca 6: Result = "Sixty"
                Ca 7: Result = "Seventy"
                Ca 8: Result = "Eighty"
                Ca 9: Result = "Ninety"
                Ca El
            End Select
            ' Convert ones place digit.
            If Val(Right(MyTens, 1)) = 0 Then
            Result = Result & " " & ConvertDigit(Right(MyTens, 1))
            El
            Result = Result & "-" & ConvertDigit(Right(MyTens, 1))
            End If
        End If
          ConvertTens = Result
      End Function
      Private Function ConvertDigit(ByVal MyDigit)
          Select Ca Val(MyDigit)
center            Ca 1: ConvertDigit = "One"
            Ca 2: ConvertDigit = "Two"
            Ca 3: ConvertDigit = "Three"
            Ca 4: ConvertDigit = "Four"
            Ca 5: ConvertDigit = "Five"
            Ca 6: ConvertDigit = "Six"
            Ca 7: ConvertDigit = "Seven"
            Ca 8: ConvertDigit = "Eight"
            Ca 9: ConvertDigit = "Nine"
            Ca El: ConvertDigit = ""
          End Select
      End Function

本文发布于:2023-05-18 13:36:39,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/113318.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:转换   编写   大写   键入   表中   实例
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图