1. 首页>百科大全 > 百科

excel把数字转成英文怎么说

作者:李俊明
2020-05-16
百科

1. excel中如何使数字变成英文字母

'通过自定义函数实现:Option Explicit'Main FunctionFunction SpellNumber(ByVal MyNumber) Dim Dollars, Cents, Temp Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = " Thousand " Place(3) = " Million " Place(4) = " Billion " Place(5) = " Trillion " ' String representation of amount. MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none. DecimalPlace = InStr(MyNumber, ".") ' Convert cents and set MyNumber to dollar amount. 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 = "No Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = "USD DOLLARS " & Dollars '& " Dollars" End Select Select Case Cents Case "" Cents = " ONLY" Case "One" Cents = " and One Cent" Case Else Cents = " and Cents " & Cents & " ONLY" End Select SpellNumber = Dollars & CentsEnd Function' Converts a number from 100-999 into textFunction GetHundreds(ByVal MyNumber) Dim Result As String If Val(MyNumber) = 0 Then Exit Function MyNumber = Right("000" & MyNumber, 3) ' Convert the hundreds place. If Mid(MyNumber, 1, 1) "0" Then Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and " End If ' Convert the tens and ones place. If Mid(MyNumber, 2, 1) "0" Then Result = Result & GetTens(Mid(MyNumber, 2)) Else Result = Result & GetDigit(Mid(MyNumber, 3)) End If GetHundreds = ResultEnd Function' Converts a number from 10 to 99 into text.Function GetTens(TensText) Dim Result As String Result = "" ' Null out the temporary function value. If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19。

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 ' If value between 20-99。 Select Case Val(Left(TensText, 1)) Case 2: Result = "Twenty " Case 3: Result = "Thirty " Case 4: Result = "Forty " Case 5: Result = "Fifty " Case 6: Result = "Sixty " Case 7: Result = "Seventy " Case 8: Result = "Eighty " Case 9: Result = "Ninety " Case Else End Select Result = Result & GetDigit _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = ResultEnd Function' Converts a number from 1 to 9 into text.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 SelectEnd Function。

2. excel中如何将阿拉伯数字自动转换成英文大写

自订函数的使用方法和内建函数大同小异。

使用插入函数的方式来使用该函数:

插入函数的方式可以从功能表的插入>>;函数

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

资料编辑列上的 Fx 按钮

以上三种方法皆可插入函数。

函数类别选使用者定义

函数名称选自订函数SpellNumber>>;确定

输入数字或选参照的储存格>>;确定

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

自订函数的共用性与流通性

如果你要在本机的任何一个活页簿都可以使用这个函数,则建议你建立一个个人巨集活页簿,并将该函数放在个人巨集活页簿内。

如果要使用这个函数的活页簿会四处在网路上流通的话,则建议将该函数附属在该活页簿内,让它随著档案在网路上奔走,不然当档案到了其他人的电脑上,而其他人的 excel 内并无 SpellNumber 这个函数时,则会出现 #NAME? 的错误值。

已记录

--------------------------------------------------------------------------------

BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW。

leonchou

论坛维护群

离线

文章: 1160

Re: 将数字转换成英文的货币表示法

« 回覆文章 #1 於: 2005-03-27, 23:51:34 »

--------------------------------------------------------------------------------

上述的微软网页亦可由此进入

/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.

excel把数字转成英文怎么说

推荐阅读
  • 努比亚z9max手机音乐效验

    该机拥有HIFI级音乐芯片,音乐效果不凡。具体体现在:1.音量调节,正常听音乐中高低音都是一个音量,而杜比音效能动态扩大某个音量。比如放打鼓声,杜比会及时提高低音加强鼓声。2.加强音域,杜比音效有开阔、集中、…

    百科 2024-09-20
  • 是atChristmas还是inChristmas

    此处该用“on”。在圣诞节正确表达应为 “on Christmas ”。有具体日期的,比如知道几月几日的都用“on” ;不知道日期,但知道年份和月份的用“in” ,知道具体时间,比如几点几分用“at”。…

    百科 2024-09-20
  • 个体工商户应交纳什么税

    纳税标准根据国家税务总局《个体工商户定期定额征收管理办法》文件精神 ,定期定额征收方式适用的税种及税率如下:1、根据《中华人民共和国增值税暂行条例》规定,自2009年1月1日起,小规模纳税人增值税征收率为3%…

    百科 2024-09-20
  • 材料成本差异率为负数是什么意思

    材料成本差异额,是指材料的实际成本和计划成本之间的差额。差异率负数表示节约差异,即实际成本比计划成本小。正数表示超支差异,即实际成本比计划成本大。…

    百科 2024-09-20
  • 塞翁失马焉知非福是什么意思

    比喻一时虽然受到损失,反而因此能得到好处。也指坏事在一定条件下可变为好事,反之亦然。形容人的心态,一定要乐观向上,任何事情都有二面性,不好的一面,有可能向好的一面转化。塞翁失马,焉知非福出自《 淮南子…

    百科 2024-09-20