Excel表格中如何将数字金额转换为英文
(如B1列写 162890元,自动转换为英文
ONE HUNDRED SIXTY TWO THOUSAND EIGHT HUNDRED NINETY DOLLARS AND NO CENTS)
1、新建Excel表格
2、 按住“Alt+F11"打开VBA编辑器
3、在VBA编辑器中单击菜单栏“插入”--模块
4、在打开的模块中输入如下代码:
Option Explicit
Function 数字转英文(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 ”
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)
El
MyNumber = ""
End If
Count = Count + 1
Loop
Select Ca Dollars
Ca ”"
Dollars = ”No Dollars”
Ca ”One"
Dollars = ”One Dollar”
Ca El
Dollars = Dollars & ” Dollars”
End Select
Select Ca Cents
Ca "”
Cents = ” and No Cents”
Ca ”One”
Cents = " and One Cent"
Ca El
六级听力分值Cents = " and " & Cents & " Cents"
End Select
数字转英文 = Dollars & Cents
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))
ladybirdEl
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
winter in my heart
Select Ca Val(TensText)
Ca 10: Result = "Ten"
里约奥运会中国金牌
Ca 11: Result = "Eleven”
Ca 12: Result = ”Twelve"
Ca 13: Result = "Thirteen"
Ca 14: Result = "Fourteen"
Ca 15: Result = ”Fifteen"
Ca 16: Result = "Sixteen"
Ca 17: Result = "Seventeen"
Ca 18: Result = ”Eighteen"
Ca 19: Result = ”Nineteen”
Ca El
brown是什么意思
End Select
El
Select Ca Val(Left(TensText, 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
Result = Result & GetDigit _
(Right(TensText, 1))
End If
GetTens = Result
End Function
Function GetDigit(Digit)
Select Ca Val(Digit)
Ca 1: GetDigit = "One”
Ca 2: GetDigit = ”Two"
Ca 3: GetDigit = "Three"
Ca 4: GetDigit = "Four”
Ca 5: GetDigit = ”Five”
Ca 6: GetDigit = ”Six"
Ca 7: GetDigit = ”Seven"
上海乐宁教育
Ca 8: GetDigit = "Eight"
Ca 9: GetDigit = "Nine"
Ca El: GetDigit = ””
End Select
End Function
5/现在回到Excel表格中,单击“B1”单元格,在菜单栏选择“插入"-—函数。
6/在打开的“插入函数"对话框的“或选择类别"中选择“用户定义”,然后选择函数“数字转英文”,单击“确定”按钮。
7/在打开的“函数参数”对话框中输入“A1”,单击“确定”按钮.
8/ 然后用填充手柄向下填充公式,现在就可以看到转换好的英文了。