将数字更改为文本

Changing Number to Text

我目前在 Google Sheet 中使用此代码将我的数字(货币)替换为文本。但是这部分显示错误

IF(IFERROR(QUERY({Y:Y},"where Col1 Contains '.'"),)<>"", " and "&REGEXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", ))," ", " ")

我应该更改什么才能使其正常工作?

我的完整代码如下: =ARRAYFORMULA(IFS(ROW(AQ:AQ)=1,"WageWords",A:A="","",TRUE,REGEXREPLACE(IF(OR(LEN(FLOOR(Y:Y,1))>=13,FLOOR(Y:Y,1)<=0),"", PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(Y:Y>=10^9," billion ",""), CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y), 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(Y:Y), REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"), IF(VALUE(MID(TEXT(INT(Y:Y), REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(Y:Y), REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," "))& IF(IFERROR(QUERY({Y:Y},"where Col1 Contains '.'"),)<>"", " and "&REGEXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", ))," ", " ")))

使用:

=ARRAYFORMULA(IF(Y:Y="",,REGEXREPLACE(IF((LEN(FLOOR(Y:Y,1))>=13)+(FLOOR(Y:Y,1)<=0),"Out of range",
 PROPER(SUBSTITUTE((CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
 IF(Y:Y>=10^9," billion ","")&
 CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),6,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),4,3))>0," million ","")&CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),9,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))&
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),7,3))," thousand ","")&CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y),
 REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(Y:Y),
 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(Y:Y), 
 REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),12,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),
 IF(VALUE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(Y:Y),
 REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),""))),"  "," "))&
 IFERROR(IF(REGEXMATCH(TO_TEXT(Y:Y), "\."), 
 " and "&REGEXEXTRACT(TO_TEXT(Y:Y), "\.(.+)")&" cents", ))),"  ", " ")))