乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>EXCEL</em>表中如何用函数把数字转化成中文大写金额格式 详细-excel 英文大

<em>EXCEL</em>表中如何用函数把数字转化成中文大写金额格式 详细-excel 英文大

作者:乔山办公网日期:

返回目录:excel表格制作


自订函数7a64e59b9ee7ad94336的使用方法和内建函数大同小异。
使用插入函数的方式来使用该函数:
<一>
插入函数的方式可以从功能表的插入>>函数

一般工具列的自动加总旁按下拉式选单选其他函数

资料编辑列上的 Fx 按钮
以上三种方法皆可插入函数。
<二>
函数类别选使用者定义
<三>
函数名称选自订函数SpellNumber>>确定
<四>
输入数字或选参照的储存格>>确定

上述方式可能会依不同的 Excel 版本而略有差异。

自订函数的共用性与流通性
如果你要在本机的任何一个活页簿都可以使用这个函数,则建议你建立一个个人巨集活页簿,并将该函数放在个人巨集活页簿内。
如果要使用这个函数的活页簿会四处在网路上流通的话,则建议将该函数附属在该活页簿内,让它随著档案在网路上奔走,不然当档案到了其他人的电脑上,而其他人的 excel 内并无 SpellNumber 这个函数时,则会出现 #NAME? 的错误值。

已记录

--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...

leonchou
论坛维护群

离线

文章: 1160

Re: 将数字转换成英文的货币表示法
« 回覆文章 #1 於: 2005-03-27, 23:51:34 »

--------------------------------------------------------------------------------
上述的微软网页亦可由此进入
http://support.microsoft.com/support/kb/articles/Q213/3/60.ASP

另提供一以内建函数转英文大写金额的方式:
在此提供的是使用 Excel 内建工作表函数达成的
[数字转英文大写] 功能,无巨集、无VBA。
可自选货币(Currency)符号,适合外国支票、汇票或相关文件使用。
内建函数应该对一般人来说比较容易理解。

由於这个是以前用 Excel97 做的,如果你认为有任何
可改进之处,或新版有更理想的做法,
(其实新版应该要纳为内建功能了不是吗)
欢迎提出来讨论。

[2003/12/19]
1.修改为支援到千万(8位数),
2.修正了小数超过两位时的Bug (采四舍五入方式)。

[2004/3/22]
修正没有小数时的 Bug
(例如 123 会显示成 ONE HUNDRED TWENTY THREE AND CENTS THREE)

[2004/4/9]
修正小数只有一位时的Bug,例如 123.40,它会显示成
one hundred twenty three and cents FORTY FOUR only.

工具:2010版excel

1、先打开excel,以下图为例,需要将A1单元格中的数字转化成中文大写金额格式并在B1单元格中显示结果;

2、选中B1单元格并输入公式“=SUBSTITUTE(SUBSTITUTE(TEXT(INT(A1),"[DBNum2][$-804]G/通用格式元"&IF(INT(A1)=A1,"整",""))&TEXT(MID(A1,FIND(".",A1&".0")+1,1),"[DBNum2][$-804]G/通用格式角")&TEXT(MID(A1,FIND(".",A1&".0")+2,1),"[DBNum2][$-804]G/通用格式分"),"零角","零"),"零分","")”;

3、按下回车键后就可以在B1单元格中得出结果了。


下面这个你拿去用吧!
="合计人民币(大写)"&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,"","整")),"零元零",""),"零元","")

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

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

使用自定义函数

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

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

效果图如7a686964616fe78988e69d83361下,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

相关阅读

关键词不能为空
极力推荐

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