2017-04-05 44 views
1

我想转换的具有小数点后三位成单词的Excel Document.The式I应用于科威特货币如下:货币转换:数字练成

=if(or(isBlank($E$89),not(isNumber($E$89)),$E$89>=power(10,15)),ifError(1/0),trim(arrayFormula(concatenate(if(trunc(mod($E$89,power(10,15,12,9,6,3}))/power(10,{12,9,6,3,0}))<100,"",switch(int(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0}))/100),1," one",2," two",3," three",4," four",5," five",6," six",7," seven",8," eight",9," nine") & " hundred") & if(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0})),100)<>0,if(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0}))>100," and",if($E$89>power(10,{15,12,9,6,3}),switch({1,2,3,4,5},5," and"),"")),"") & if(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,12,9,6,3,0})),100)=0,"",if(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0})),100)<20,IFERROR(switch(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0})),100),1," one",2," two",3," three",4," four",5," five",6," six",7," seven",8," eight",9," nine",10," ten",11," eleven",12," twelve",13," thirteen",14," fourteen",15," fifteen",16," sixteen",17," seventeen",18," eighteen",19," nineteen")),IFERROR(switch(int(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0})),100)/10),2," twenty",3," thirty",4," forty",5," fifty",6," sixty",7," seventy",8," eighty",9," ninety")) & if(mod(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,12,9,6,3,0})),100),10)=0,"","-" & IFERROR(switch(mod(mod(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0})),100),10),1,"one",2,"two",3,"three",4,"four",5,"five",6,"six",7,"seven",8,"eight",9,"nine"))))) & if(trunc(mod($E$89,power(10,{15,12,9,6,3}))/power(10,{12,9,6,3,0}))=0,"",IFERROR(switch({1,2,3,4,5},1," trillion",2," billion",3," million",4," thousand"))))) & if($E$89>=2," Dinar only",if($E$89>=1," Dinar only","")) & if((round($E$89-trunc($E$89),3)*1000=0)+($E$89<1),""," and") & switch(trunc(round($E$89-trunc($E$89),3)*1000,-2)/100,1," one-hundred",2," two",3,-hundred" three-hundred",4," four-hundred",5," five-hundred",6," six-hundred",7," seven-hundred",8," eight-hundred",9," nine-hundred"& if(round($E$89-trunc($E$89),3)*1000-trunc(round($E$89-trunc($E$89),3)*1000,-2)<20,switch(round($E$89-trunc($E$89),3)*1000-trunc(round($E$89-trunc($E$89),3)*1000,-1),0,"",1," one",2," two",3," three",4," four",5," five",6," six",7," seven",8," eight",9," nine",10," ten",11," eleven",12," twelve",13," thirteen",14," fourteen",15," fifteen",16," sixteen",17," seventeen",18," eighteen",19," nineteen"),switch((round($E$89-trunc($E$89),3)*1000-trunc(round($E$89-trunc($E$89),3)*1000,-2))/10,2," twenty",3," thirty",4," forty",5," fifty",6," sixty",7," seventy",8," eighty",9," ninety") & if(mod(round($E$89-trunc($E$89),3)*1000,10)=0,"","-" & switch(round($E$89-trunc($E$89),3)*1000-trunc(round($E$89-trunc($E$89),3)*1000,-1),0"",1,"one",2,"two",3,"three",4,"four",5,"five",6,"six",7,"seven",8,"eight",9,"nine"))) & " fils only"))) 

所示的误差是

式解析错误

对于给定的输入:

111.250

我期望得到的输出为:

有111个第纳尔,只有250费尔。

+0

该公式比任何公式都要长。你真正应该问的是*我怎样才能让'x'看起来像'y' * - 因为我确信这里的人能够提出一个比解决你的解析错误更好的解决方案。但是,通过向我们展示您的尝试,您绝对做到了正确的事情......它表明了您的努力,这将鼓励大量人员提供帮助。 – CallumDA

+0

对不起 - 我的意思是说更清楚一点是:请编辑您的问题,包括一些示例数据和你期望的输出看起来像 – CallumDA

+0

谢谢你的更正。更新了这个问题。 –

回答

0

尝试寻找JavaScript解决方案,然后使用custom function

我发现是这样的代码,通过@Vilas Shetkar提供:

https://stackoverflow.com/a/37409158/5372400

我测试过此代码,它工作在表,所以你可以采取这种或其他similiar解决您的需要。

+0

感谢您的回复。但我只是想与预定义的功能,如我用。可以帮助任何人吗? –