在工作中可能用到在EXCEL中输入一个数字,可以自动转换成英文金额标识。EXCEL或WPS通过VBA自定义函数可以实现。

1. 新建Excel表格

2. 按住"AIt+F11”打开VBA编辑器

3. 在VBA编辑器中单击菜单栏"插入→模块

4. 在打开的模块中输入如下代码→保存→回到excel界面:

 Function 数字转英文大写金额(ByVal MyNumber)Dim Dollars, TempDim DecimalPlace, CountReDim Place(9) As StringApplication.Volatile TruePlace(2) = " THOUSAND "Place(3) = " MILLION "Place(4) = " BILLION "Place(5) = " TRILLION "MyNumber = Trim(Str(MyNumber))DecimalPlace = InStr(MyNumber, ".")If DecimalPlace > 0 ThenCents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))End IfCount = 1Do While MyNumber <> ""Temp = GetHundreds(Right(MyNumber, 3))If Temp <> "" Then Dollars = Temp & Place(Count) & DollarsIf Len(MyNumber) > 3 ThenMyNumber = Left(MyNumber, Len(MyNumber) - 3)ElseMyNumber = ""End IfCount = Count + 1LoopSelect Case DollarsCase ""Dollars = ""Case "One"Dollars = "One Dollar"Case ElseDollars = "ASY US DOLLARS " & Dollars & " ONLY"  '/* 注释:&前、后可增加内容 */'End Select数字转英文大写金额 = DollarsEnd Function
Function GetHundreds(ByVal MyNumber)Dim Result As StringIf Val(MyNumber) = 0 Then Exit FunctionMyNumber = Right("000" & MyNumber, 3)If Mid(MyNumber, 1, 1) <> "0" ThenResult = GetDigit(Mid(MyNumber, 1, 1)) & " HUNDRED "End IfIf Mid(MyNumber, 2, 1) <> "0" ThenResult = Result & GetTens(Mid(MyNumber, 2))ElseResult = Result & GetDigit(Mid(MyNumber, 3))End IfGetHundreds = ResultEnd Function
Function GetTens(TensText)Dim Result As StringResult = ""If Val(Left(TensText, 1)) = 1 ThenSelect 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 ElseEnd SelectElseSelect 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 ElseEnd SelectResult = Result & GetDigit _(Right(TensText, 1))End IfGetTens = ResultEnd 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

*代码来自网络

5. EXCEL插入函数,或选择类别-用户自定义-“数字转英文大写金额”这个函数,引用即可。

例:如在A1录入阿拉伯数字,在B1中插入函数“=数字转英文大写金额(A1)”。

EXCEL电子表格:将数字转换成英文金额相关推荐

  1. php数字转英文,PHP金额数字转换成英文

    PHP金额数字转换成英文 $numTable[40]="FORTY "; $numTable[50]="FIFTY "; $numTable[60]=" ...

  2. oracle 英文转数字,数字转换成英文

    今天看到一篇帖子,讲述的是如何把数字转换成英文表示.本人觉得不错,将其收入我的经典sql.原文如下: 利用to_timestamp,to_char两个内置函数将范围为(-999999999,99999 ...

  3. 将数字转换成中文金额的大写形式

    package com.unteck.fms.web.businessdata.controller; import org.springframework.beans.factory.annotat ...

  4. 在英文版的excel中把数字转换成中文金额大写

    用VBA自定义一个大写金额转换的函数,在公式中输入此函数名就可以了. 具体方法:按 Alt+F11 ,在VBA编辑器菜单中点 插入→模块,将下面的函数复制到插入的模块当中, '============ ...

  5. mysql金额数字转成中文_数字转换成汉字金额(转)

    1 2 3 //测试工程4 5 staticvoidMain(string[] args)6 7 {8 9 Console.WriteLine("请输入金额");10 11 str ...

  6. 将15位数字转换成人民币金额

    直接上代码,每个步骤都有注释.难点在零的处理上. # 用字典变量x来保存0~9,和中文大写 x = {0:'零', 1:'壹', 2:'贰', 3:'叁', 4:'肆', 5:'伍', 6:'陆', ...

  7. uni-app - javaScript - vue2 将数字转换成英文字母

    1.方法调用 checkNum(num) { //把数字转换为字母console.log(num + "把数字转换为字母");if (typeof(num) == 'number' ...

  8. python 数字转化excel行列_Python 3 实现数字转换成Excel列名(10进制到26进制的转换函数)...

    背景: 最近在看一些Python爬虫的相关知识,讲爬取的一些数据写入到Excel表中,当时当列的数目不确定的情况下,如何通过遍历的方式讲爬取的数据写入到Excel中. 开发环境: Python 3  ...

  9. 如何把excel里面中文小写数字转换成阿拉伯数字

    今天跟大家分享一下如何把excel里面中文小写数字转换成阿拉伯数字 1.打开要处理的Excel文件 2.将E列数据复制一份到F列中并选中 3.点击下图选项(Excel工具箱,百度即可了解详细下载安装信 ...

最新文章

  1. jee websocket搭建总结
  2. 聊聊hystrix的execution.isolation.semaphore.maxConcurrentRequests属性
  3. Python中调用Linux命令并获取返回值
  4. Python数据库访问公共组件及模拟Http请求
  5. Apollo浏览全貌
  6. 如何成为一位杰出的程序员
  7. c# 使用GDAL处理大图
  8. 打印pdf就一页_我就是死都不想在mac上装第三方pdf软件
  9. 基于JAVA+Swing+MYSQL的研究生科研信息管理系统
  10. android 微信支付 2,Android微信支付获取二次签名Sign的方法
  11. java 定义动态接口_使用自定义annotation接口进行aspectj动态缓存
  12. 证明$r(A^TA) = r(A)$
  13. 分享两款迷你FTP服务器
  14. 关于idea注释等颜色设置
  15. win10计算机变成了英文,win10变成英文【处理方式】
  16. STM32 使用串口下载程序( ISP 一键下载)
  17. 2022年希捷、东芝、HGST、西数硬盘
  18. android毕业论文结论,毕业论文经典结束语
  19. xp系统关闭闲置服务器,教你win10系统空闲进程占用cpu怎么关闭
  20. Frontend Development

热门文章

  1. 百数人力行政管理系统能力展示——人力资源
  2. 如何很好的解决网站劫持?
  3. 动态更新App的图标(AppIcon)
  4. C# 常用的文件IO操作
  5. Springboot整合支付宝支付加内网穿透工具实现本地回调
  6. 详解央行数字货币和数字票据交易平台架构(多图)
  7. 概述长程攻击,Part-1:攻击
  8. 【C++】美发店管理系统
  9. spring动态获取bean
  10. Mozilla 正在火狐中集成谷歌翻译;内存产能增长减缓,基本告别降价