在EXCEL中,怎样把一串数值转化为英文大写金额,要按照以下格式

格式必须是SAY U. S. DOLLARS THIRTY SEVEN THOUSAND NINE HUNDRED NINETY NINE AND 52/100 ONLY.
如果为55555.00(美分为0),则格式是
SAY U. S. DOLLARS THIRTY SEVEN THOUSAND NINE HUNDRED AND NINETY NINE ONLY.
某一栏的原数据是数字,如123456.78,要转换为如上格式的英文大写

必须用VBA才能实现。
请补充:
(1)有美分时,百位和十位之间无AND,对吧?
(2)1234567.56的格式是什么?即,百万和十万之间是否用AND。

根据https://www.thebalance.com/write-numbers-using-words-4083198的规则,修改了微软提供的VBA代码。
按Alt+F11,打开VBA窗口,点击插入、模块,将下列代码复制过去,然后可以在工作表中用=SpellNumber(A1)或=SpellNumber(234.56)的形式进行转换。代码:
Option Explicit
'Main Function
Function 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 = Right(MyNumber * 100, 2) * 1
'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 = Dollars & " Dollars"
End Select
Select Case Cents
Case ""
Cents = " Only"
Case Else
Cents = " and " & Cents & "/100" & " Only"
End Select
SpellNumber = "SAY U. S. DOLLARS " & Dollars & Cents
End Function
' Converts a number from 100-999 into text
Function 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 "
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 = Result
End 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 = Result
End 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 Select
End Function

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-02-26
需要使用函数,如果你转换的多,需要用到宏

解答参考:http://www.excelpx.com/home/show.aspx?id=33618

转化英文字母大小写的几个EXCEL函数
[日期:2011-12-30] 来源: 作者:admin [字体:大 中 小]

假设您为了增强可读性,要将文字从大写转换为小写,或从小写转换为适当的大小写混合(如首字母大写)。若要更改文字的大小写,可以使用 UPPER、LOWER 或 PROPER 函数,如下例所示。

示例
如果将示例复制到一个空白工作表中,可能会更易于理解。

如何复制示例?

1
2
3
4
5
6
A B
名称
sara Davis
公式 说明(结果)
=UPPER(A2) 将文字全部更改为大写 (SARA DAVIS)
=LOWER(A2) 将文字全部更改为小写 (sara davis)
=PROPER(A2) 将文字更改为首字母大写 (Sara Davis)

注释 通常,使用这些函数一次只能更改一个单元格中文字的大小写。若要更改某单元格区域内文字的大小写,可以在数组公式中使用这些函数。例如,若要将单元格 A1:A3 中的文字全部转换为大写,请选择单元格 B1:B3,输入公式 =UPPER(A1:A3),然后按 Ctrl+Shift+Enter 使该公式成为数组公式。单元格 B1:B3 中显示的结果全部为大写。有关详细信息,请参阅数组公式指南和示例。

函数详细信息
UPPER 函数 将文字转换为大写。

语法

UPPER(text)

括号内的“text”参数指的是要转换为大写的文字。UPPER 不更改文字内的非字母字符。

LOWER 函数 将文字串中的所有大写字母转换为小写。

语法

LOWER(text)

括号内的“text”参数指的是要转换为小写的文字。LOWER 不更改文字内的非字母字符。

PROPER 函数 将文字串的首字母以及文字中任何非字母字符之后的任何其他字母转换成大写。将其余字母转换为小写。

语法

PROPER(text)

括号内的“text”参数指的是用引号括起来的文字、返回文字的公式、对含有要部分转换为大写的文字的单元格的引用。
第2个回答  2013-03-04
亲,您这些都是英文大写啊。。。还要怎么转换呢、楼上的太强大了,确实有个函数公式可以直接转换,但是我忘了,他的那么多,我都看不懂,好像excel设置单元格式---特殊--大小自己选。

可是亲,您的英文大写???????好像还真心的只有那位强大的函数。。。
第3个回答  2018-03-06

找了找,好像只能vba编程解决。代码见连接,仅供参考。

网页链接

第4个回答  2018-03-06
要用vba来完成。。。。
相似回答