示例:
value | desired output
-------+----------------------------
300 | Three Hundred
300.50 | Three Hundred and 50 cents
我在Google表格中找不到实现此目的的方法,而且我也不聪明,无法构建任何东西。
答案 0 :(得分:1)
显示可以执行此操作的Excel公式。我刚刚在Google表格中进行了测试,而且也可以使用。
公式是
=IF(OR(LEN(FLOOR(E3,1))>=13,FLOOR(E3,1)<=0),"Out of range",PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(E3>=10^9," billion ",""),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(E3),REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(E3),REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," ")&IF(FLOOR(E3,1)>1," dollars"," dollar")))
答案 1 :(得分:0)
IMPORTRANGE
在 F6 中导入值,并使用另一个IMPORTRANGE
从中导入转换后的值B11 答案 2 :(得分:0)
在dominic's答案中四处调整,以完全满足您的需求:
=REGEXREPLACE(IF(OR(LEN(FLOOR(A1,1))>=13,FLOOR(A1,1)<=0),"Out of range",
PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),
CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),
IF(A1>=10^9," billion ",""),
CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),
CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),
CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),
CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
IF(VALUE(MID(TEXT(INT(A1),
REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(A1),
REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," "))&
IF(IFERROR(QUERY({A1},"where Col1 Contains '.'"),)<>"",
" and "®EXEXTRACT(TO_TEXT(A1), "\.(.+)")&" cents", ))," ", " ")
答案 3 :(得分:0)
=NUMBERTEXT("EUR 25") => twenty-five euro
=MONEYTEXT(25,"EUR") => twenty-five euro
答案 4 :(得分:0)
由于这是专门针对Google表格的,因此您可以使用此
=REGEXEXTRACT(JOIN(", ",QUERY(IMPORTDATA("https://www.calculatorsoup.com/calculators/conversions/numberstowords.php?number=" & A1 & "&format=words&letter_case=lowercase&action=solve"),"where Col1 contains '<div id=""answer""><br>'")),">([^<]+)")
其中A1是要转换的数字
信用:spell number formulae or number to words。该链接中还有许多其他解决方案,例如,这是一种使用数组公式的方法
=ArrayFormula(if(A2:A="","",if(len(int(A2:A))<13,"",if(right(left(int(A2:A),len(int(A2:A))-12),3)+0>99,choose(left(right(left(int(A2:A),len(int(A2:A))-12),3))+0,"one","two","three","four","five","six","seven","eight","nine")&" hundred ",)&if(right(right(left(int(A2:A),len(int(A2:A))-12),3),2)*1>19,choose(left(right(right(left(int(A2:A),len(int(A2:A))-12),3),2))-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(right(left(int(A2:A),len(int(A2:A))-12),3))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(right(right(left(int(A2:A),len(int(A2:A))-12),3),2)+1,"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"))&" trillion")&" "&if(len(int(A2:A))<10,"",if(right(left(int(A2:A),len(int(A2:A))-9),3)+0>99,choose(left(right(left(int(A2:A),len(int(A2:A))-9),3))+0,"one","two","three","four","five","six","seven","eight","nine")&" hundred ",)&if(right(right(left(int(A2:A),len(int(A2:A))-9),3),2)*1>19,choose(left(right(right(left(int(A2:A),len(int(A2:A))-9),3),2))-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(right(left(int(A2:A),len(int(A2:A))-9),3))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(right(right(left(int(A2:A),len(int(A2:A))-9),3),2)+1,"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"))&" billion")&" "&if(len(int(A2:A))<7,"",if(right(left(int(A2:A),len(int(A2:A))-6),3)+0>99,choose(left(right(left(int(A2:A),len(int(A2:A))-6),3))+0,"one","two","three","four","five","six","seven","eight","nine")&" hundred ",)&if(right(right(left(int(A2:A),len(int(A2:A))-6),3),2)*1>19,choose(left(right(right(left(int(A2:A),len(int(A2:A))-6),3),2))-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(right(left(int(A2:A),len(int(A2:A))-6),3))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(right(right(left(int(A2:A),len(int(A2:A))-6),3),2)+1,"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"))&" million")&" "&if(len(int(A2:A))<4,"",if(right(left(int(A2:A),len(int(A2:A))-3),3)+0>99,choose(left(right(left(int(A2:A),len(int(A2:A))-3),3))+0,"one","two","three","four","five","six","seven","eight","nine")&" hundred ",)&if(right(right(left(int(A2:A),len(int(A2:A))-3),3),2)*1>19,choose(left(right(right(left(int(A2:A),len(int(A2:A))-3),3),2))-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(right(left(int(A2:A),len(int(A2:A))-3),3))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(right(right(left(int(A2:A),len(int(A2:A))-3),3),2)+1,"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"))&" thousand")&" "&if(len(int(A2:A))<1,"",if(right(left(int(A2:A),len(int(A2:A))-0),3)+0>99,choose(left(right(left(int(A2:A),len(int(A2:A))-0),3))+0,"one","two","three","four","five","six","seven","eight","nine")&" hundred ",)&if(right(right(left(int(A2:A),len(int(A2:A))-0),3),2)*1>19,choose(left(right(right(left(int(A2:A),len(int(A2:A))-0),3),2))-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(right(left(int(A2:A),len(int(A2:A))-0),3))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(right(right(left(int(A2:A),len(int(A2:A))-0),3),2)+1,"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen")))&if(int(A2:A)=0,"0 dollar",if(int(A2:A)<2," dollar"," dollars"))&iferror(" and "&if(round(mod(A2:A,1)*100,2)>19,choose(left(mod(A2:A,1)*100)-1,"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety")&choose(right(round(mod(A2:A,1)*100,2))+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),choose(round(mod(A2:A,1)*100,2)+1,"no","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"))&" cents")))
输出为
300 three hundred dollars and no cents
300.5 three hundred dollars and fifty cents
如果您的数字位于其他位置,只需将数组公式中的A2:A
更改为正确的位置
另一种方法是通过选择 File> Make a copy 然后使用
来克隆下面的2张已经制作好的图纸。信用:Amount or Numbers to Words Converter Using Google Sheets。作者还介绍了只需要一张纸的较新版本。如果您想使用那些clone it from here
答案 5 :(得分:0)
您可以使用此方法将您的货币转换为文字:
function convertToWords(input) {
var a, b, c, d, e, output, outputA, outputB, outputC, outputD, outputE;
var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
if (input === 0) { // Zero
output = "Rupees zero";
} else if (input == 1) { // One
output = "Rupee one only";
} else { // More than one
// Tens
a = input % 100;
outputA = oneToHundred_(a);
// Hundreds
b = Math.floor((input % 1000) / 100);
if (b > 0 && b < 10) {
outputB = ones[b];
}
// Thousands
c = (Math.floor(input / 1000)) % 100;
outputC = oneToHundred_(c);
// Lakh
d = (Math.floor(input / 100000)) % 100;
outputD = oneToHundred_(d);
// Crore
e = (Math.floor(input / 10000000)) % 100;
outputE = oneToHundred_(e);
// Make string
output = "Rupees";
if (e > 0) {
output = output + " " + outputE + " crore";
}
if (d > 0) {
output = output + " " + outputD + " lakh";
}
if (c > 0) {
output = output + " " + outputC + " thousand";
}
if (b > 0) {
output = output + " " + outputB + " hundred";
}
if (input > 100 && a > 0) {
output = output + " and";
}
if (a > 0) {
output = output + " " + outputA;
}
output = output + " only";
}
return output;
}
function oneToHundred_(num) {
var outNum;
var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
var tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
if (num > 0 && num < 10) { // 1 to 9
outNum = ones[num]; // ones
} else if (num > 9 && num < 20) { // 10 to 19
outNum = teens[(num % 10)]; // teens
} else if (num > 19 && num < 100) { // 20 to 100
outNum = tens[Math.floor(num / 10)]; // tens
if (num % 10 > 0) {
outNum = outNum + " " + ones[num % 10]; // tens + ones
}
}
return outNum;
}