怎样在EXCEL中数字转人民币大写
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了怎样在EXCEL中数字转人民币大写相关的知识,希望对你有一定的参考价值。
这个可以用公式来完成:
EXCEL2007公式如下:
1、将需要转为人民币的数字输入A1单元格
2、在B1单元格输入公式:=SUBSTITUTE(SUBSTITUTE(IF(ROUND(A1,2),TEXT(A1,";负")&TEXT(INT(ABS(A1)+0.5%),"[dbnum2]G/通用格式圆;;")&TEXT(RIGHT(TEXT(A1,".00"),2),"[dbnum2]0角0分;;整"),),"零角",IF(A1^2<1,,"零")),"零分","整")
3、完成。当然你可以向下复制。同样可以将左边A2以下的单元格转换为人民币大写。
参考技术A 将123转换成中文大写=TEXT("123","[DBNum2]")
将A1单元格内容转换成中文大写
=TEXT(A1,"[DBNum2]")本回答被提问者采纳 参考技术B 假设1000.00在A1单元格,则公式为
=TEXT(INT(A1),"[DBNUM2]")&"元"&TEXT(MID(A1,LEN(INT(A1))+2,1),"[DBNUM2]D角")&TEXT(MID(A1,LEN(INT(A1))+3,1),"[DBNUM2]D分")&"整" 参考技术C 如数据在A4,在C4 中输入公式:=TEXT(A4,"[DBnum2]G/通用格式") 参考技术D 鼠标右键“设置单元格格式”》数字》特殊》中文大写数字》搞定!!!
http://jingyan.baidu.com/article/6181c3e077b20a152ff1534e.html
人民币数字金额转大写金额
public class t { public static String Trans2RMB(String money) { int index = money.indexOf("."); if (index < 0) {// 没有角分 money = money + ".00"; index = money.indexOf("."); } if (money.substring(index, money.length()).length() < 3) {// 没有分 money = money + "0"; index = money.indexOf("."); } money = money.replaceAll("\\D", "");// 去除"." int length = money.length(); // 货币大写形式 String bigLetter[] = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; // 货币单位 String unit[] = { "仟", "佰", "拾", "万", "仟", "佰", "拾", "亿", "仟", "佰", "拾", "万", "仟", "佰", "拾", "元", "角", "分" }; StringBuffer buf = new StringBuffer(""); for (int i = 0; i < length; i++) { int num = Integer.parseInt(String.valueOf(money.charAt(i))); buf.append(bigLetter[num]); buf.append(unit[unit.length - money.length() + i]); } String moneyTmp = buf.toString(); buf = null; for (int i = 0; i < 4; i++) { // 亿 万 元是四个为单元的最后一位比如1234(亿)4567(万)7891(元) moneyTmp = moneyTmp.replaceAll("零亿", "亿"); moneyTmp = moneyTmp.replaceAll("零万", "万"); moneyTmp = moneyTmp.replaceAll("零仟", "零"); moneyTmp = moneyTmp.replaceAll("零佰", "零"); moneyTmp = moneyTmp.replaceAll("零拾", "零"); moneyTmp = moneyTmp.replaceAll("零元", "元"); moneyTmp = moneyTmp.replaceAll("零角", "零"); moneyTmp = moneyTmp.replaceAll("零分", "整"); } moneyTmp = moneyTmp.replaceAll("亿万", "亿"); moneyTmp = moneyTmp.replaceAll("拾元", "拾元零"); moneyTmp = moneyTmp.replaceAll("[零]{1,}", "零");// 多个连续的零替换为一个零 moneyTmp = moneyTmp.replaceAll("零整", "整"); return moneyTmp; } public static void main(String[] args) { String money; money = "230067890080.01"; System.out.println(Trans2RMB(money)); money = "230067890080.11"; System.out.println(Trans2RMB(money)); money = "230067890080.10"; System.out.println(Trans2RMB(money)); money = "230067890081.01"; System.out.println(Trans2RMB(money)); money = "230067890081.11"; System.out.println(Trans2RMB(money)); money = "230067890081.10"; System.out.println(Trans2RMB(money)); money = "230067890080.01"; System.out.println(Trans2RMB(money)); money = "230667890080.01"; System.out.println(Trans2RMB(money)); money = "230007890080.01"; System.out.println(Trans2RMB(money)); money = "230607890080.01"; System.out.println(Trans2RMB(money)); money = "200067890080.01"; System.out.println(Trans2RMB(money)); money = "200067890080.11"; System.out.println(Trans2RMB(money)); money = "200067890080.10"; System.out.println(Trans2RMB(money)); money = "200007890080.01"; System.out.println(Trans2RMB(money)); money = "200000890080.11"; System.out.println(Trans2RMB(money)); money = "200000090080.10"; System.out.println(Trans2RMB(money)); money = "200000000080.10"; System.out.println(Trans2RMB(money)); money = "200007890080"; System.out.println(Trans2RMB(money)); money = "200000890080.1"; System.out.println(Trans2RMB(money)); money = "200607890080.01"; System.out.println(Trans2RMB(money)); money = "200600890080.11"; System.out.println(Trans2RMB(money)); money = "200600090080.10"; System.out.println(Trans2RMB(money)); money = "200600000080.10"; System.out.println(Trans2RMB(money)); money = "20007800080.01"; System.out.println(Trans2RMB(money)); money = "10001.01"; System.out.println(Trans2RMB(money)); // System.out.println(new // StringBuffer(Arrays.toString(unit)).reverse()); // String small[] = { "分", "角" }; // String[] ss = new String[] { "", "元" }; // System.out.println(MoneyUtil.Trans2RMB(".")); // System.out.println(MoneyUtil.Trans2RMB(".0")); // System.out.println(MoneyUtil.Trans2RMB("0.0")); // System.out.println(MoneyUtil.Trans2RMB("0.00")); // System.out.println(MoneyUtil.Trans2RMB("0.000")); // System.out.println(MoneyUtil.Trans2RMB("123456789.0")); // System.out.println(MoneyUtil.Trans2RMB("1234")); // System.out.println(MoneyUtil.Trans2RMB("1111.")); // System.out.println(MoneyUtil.Trans2RMB("1011.011")); // System.out.println(MoneyUtil.Trans2RMB("00012340000000000.011")); // // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾元零壹分 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾元零壹角壹分 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾元零壹角整 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾壹元零壹分 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾壹元壹角壹分 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾壹元壹角整 // 贰仟叁佰亿陆仟柒佰捌拾玖万零捌拾元零壹分 // 贰仟叁佰零陆亿陆仟柒佰捌拾玖万零捌拾元零壹分 // 贰仟叁佰亿零柒佰捌拾玖万零捌拾元零壹分 // 贰仟叁佰零陆亿零柒佰捌拾玖万零捌拾元零壹分 // 贰仟亿陆仟柒佰捌拾玖万零捌拾元零壹分 // 贰仟亿陆仟柒佰捌拾玖万零捌拾元零壹角壹分 // 贰仟亿陆仟柒佰捌拾玖万零捌拾元零壹角整 // 贰仟亿零柒佰捌拾玖万零捌拾元零壹分 // 贰仟亿零捌拾玖万零捌拾元零壹角壹分 // 贰仟亿零玖万零捌拾元零壹角整 // 贰仟亿零捌拾元零壹角整 // 贰仟亿零柒佰捌拾玖万零捌拾元整 // 贰仟亿零捌拾玖万零捌拾元零壹角整 // 贰仟零陆亿零柒佰捌拾玖万零捌拾元零壹分 // 贰仟零陆亿零捌拾玖万零捌拾元零壹角壹分 // 贰仟零陆亿零玖万零捌拾元零壹角整 // 贰仟零陆亿零捌拾元零壹角整 // 贰佰亿零柒佰捌拾万零捌拾元零壹分 } }
以上是关于怎样在EXCEL中数字转人民币大写的主要内容,如果未能解决你的问题,请参考以下文章