早期工作嵌套if语句公式不再适用于Google新工作表

时间:2017-04-04 17:35:02

标签: if-statement google-sheets spreadsheet

有一个公式(用于将数字中的金额转换为单词中的金额)在早期版本的Google表格中正常工作。在新工作表中,它不再起作用并发出以下错误:

  

错误:函数CHOOSE参数1值为0.有效值介于1和19之间。

公式有点大且复杂(多功能) - 请参阅下面的链接,参见公式 - (在单元格B2中) -

https://docs.google.com/spreadsheets/d/1XdcKbxKvIOSFK37zwULZns6giE9ounHPS5iHrRFkvIk/edit#gid=882895877

=arrayFormula(concatenate(if(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0}))<100,"",choose(int(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0}))/100)," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine") & " Hundred") & if(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100)<>0,if(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0}))>100," and",if(A2>power(10,{11,9,7,5,3}),choose({1,2,3,4,5},"","","",""," and"),"")),"") & if(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100)=0,"",if(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100)<20,choose(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100)," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine"," Ten"," Eleven"," Twelve"," Thirteen"," Fourteen"," Fifteen"," Sixteen"," Seventeen"," Eighteen"," Nineteen"),choose(int(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100)/10),""," Twenty"," Thirty"," Forty"," Fifty"," Sixty"," Seventy"," Eighty"," Ninety") & if(mod(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100),10)=0,""," " & choose(mod(mod(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0})),100),10),"One","Two","Three","Four","Five","Six","Seven","Eight","Nine")))) & if(trunc(mod(A2,power(10,{11,9,7,5,3}))/power(10,{9,7,5,3,0}))=0,"",choose({1,2,3,4,5}," Arab"," Crore"," Lakh"," Thousand","")))) & " only"

1 个答案:

答案 0 :(得分:1)

根据CHOOSE Function Documentation如果索引为零,负数或大于提供的选项数,则为#VALUE!错误被返回。

话虽这么说,我认为你可以通过计算数字来完成这项任务,然后通过使用一系列= RIGHT()函数隔离你的数字来选择每个数字的单词版本。