gpt4 book ai didi

excel - 将 Excel 值转换为单词(英文)

转载 作者:行者123 更新时间:2023-12-04 22:08:29 29 4
gpt4 key购买 nike

我发现这个公式可以将金额转换为单词,但它不能 100% 起作用。每当金额以 20,30, 40 等结尾时,都会出现错误。例如 1020 会出错,但 1019 和 1021 可以正常工作。我试图自己解决这个问题,但没有运气。它必须是公式(与之交互的软件(Google Docs)无法处理 VBA 脚本。

这是公式:

=IF(H53<10^12,
IF(INT(H53/10^9)>0,
IF(INT(H53/10^11)>0,
INDEX(
{"One ","Two ","Three","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(INT(H53/10^11),{1,2,3,4,5,6,7,8,9})
)&"Hundred ",
"")&
IF(MOD(INT(H53/10^9),100)<20,
INDEX(
{"","One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine ","Ten ",
"Eleven ","Twelve","Thirteen","Fourteen ","Fifteen","Sixteen","Seventeen","Eighteen ","Nineteen"},
MATCH(MOD(INT(H53/10^9),100),{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19})
),
INDEX(
{"","Twenty ","Thirty ","Fourty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "},
MATCH(INT(MOD(INT(H53/10^9),100)/10),{1,2,3,4,5,6,7,8,9})
)&
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(INT(H53/10^9),10),{1,2,3,4,5,6,7,8,9})
)
)&" Billion ",
""
)&
IF(MOD(INT(H53/10^6),10^3)>0,
IF(INT(MOD(INT(H53/10^6),10^3)/100)>0,
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(INT(MOD(INT(H53/10^6),10^3)/100),{1,2,3,4,5,6,7,8,9})
)&"Hundred ",
"")&
IF(MOD(INT(H53/10^6),100)<20,
INDEX(
{"","One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine ","Ten ",
"Eleven ","Twelve","Thirteen","Fourteen ","Fifteen ","Sixteen","Seventeen","Eighteen ","Nineteen"},
MATCH(MOD(INT(H53/10^6),100),{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19})
),
INDEX(
{"","Twenty ","Thirty ","Fourty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "},
MATCH(INT(MOD(INT(H53/10^6),100)/10),{1,2,3,4,5,6,7,8,9})
)&
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(INT(H53/10^6),10),{1,2,3,4,5,6,7,8,9})
)
)&" Million ",
""
)&
IF(MOD(INT(H53/10^3),10^3)>0,
IF(INT(MOD(INT(H53/10^3),10^3)/100)>0,
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(INT(MOD(INT(H53/10^3),10^3)/100),{1,2,3,4,5,6,7,8,9})
)&"Hundred ",
"")&
IF(MOD(INT(H53/10^3),100)<20,
INDEX(
{"","One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine ","Ten ",
"Eleven ","Twelve","Thirteen","Fourteen ","Fifteen ","Sixteen","Seventeen","Eighteen ","Nineteen"},
MATCH(MOD(INT(H53/10^3),100),{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19})
),
INDEX(
{"","Twenty ","Thirty ","Fourty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "},
MATCH(INT(MOD(INT(H53/10^3),100)/10),{1,2,3,4,5,6,7,8,9})
)&
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(INT(H53/10^3),10),{1,2,3,4,5,6,7,8,9})
)
)&" Thousand ",
""
)&
IF(MOD(MOD(H53,10^4),10^3)>0,
IF(INT(MOD(MOD(H53,10^4),10^3)/100)>0,
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(INT(MOD(MOD(H53,10^4),10^3)/100),{1,2,3,4,5,6,7,8,9})
)&"Hundred ",
""
)&
IF(MOD(MOD(MOD(H53,10^4),10^3),100)<20,
INDEX(
{"","One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine ","Ten ",
"Eleven ","Twelve","Thirteen","Fourteen ","Fifteen ","Sixteen","Seventeen","Eighteen ","Nineteen"},
MATCH(MOD(MOD(MOD(H53,10^4),10^3),100),{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19})
),
INDEX(
{"","Twenty ","Thirty ","Fourty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "},
MATCH(INT(MOD(MOD(MOD(H53,10^4),10^3),100)/10),{1,2,3,4,5,6,7,8,9})
)&
INDEX(
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(MOD(MOD(H53,10^4),10^3),10),{1,2,3,4,5,6,7,8,9})
)
),
""
),
""
) & " Rands"

最佳答案

问题出在最后一部分:

 INDEX({"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(MOD(MOD(H53,10^4),10^3),10),{1,2,3,4,5,6,7,8,9})
MOD(MOD(MOD(H53,10^4),10^3),10)将返回 0 ,在1-9中没有找到。

因此,上述行应修改为:
 INDEX({"", "One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
MATCH(MOD(MOD(MOD(H53,10^4),10^3),10),{0, 1,2,3,4,5,6,7,8,9})

这个问题也存在于公式的其他领域。

所有在这个完整的公式中都是固定的(它还添加了一些不一致地遗漏的空格):
=IF(B1<10^12,
IF(INT(B1/10^9)>0,
IF(INT(B1/10^11)>0,
INDEX(
{"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(INT(B1/10^11),{1;2;3;4;5;6;7;8;9})
)&"Hundred ",
"")&
IF(MOD(INT(B1/10^9),100)<20,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine ";"Ten ";"Eleven ";"Twelve ";"Thirteen ";"Fourteen ";"Fifteen ";"Sixteen ";"Seventeen ";"Eighteen ";"Nineteen "},
MATCH(MOD(INT(B1/10^9),100),{0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19})
),
INDEX(
{"";"Twenty ";"Thirty ";"Fourty ";"Fifty ";"Sixty ";"Seventy ";"Eighty ";"Ninety "},
MATCH(INT(MOD(INT(B1/10^9),100)/10),{1;2;3;4;5;6;7;8;9})
)&
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(MOD(INT(B1/10^9),10),{0;1;2;3;4;5;6;7;8;9})
)
)&" Billion ",
""
)&
IF(MOD(INT(B1/10^6),10^3)>0,
IF(INT(MOD(INT(B1/10^6),10^3)/100)>0,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(INT(MOD(INT(B1/10^6),10^3)/100),{0;1;2;3;4;5;6;7;8;9})
)&"Hundred ",
"")&
IF(MOD(INT(B1/10^6),100)<20,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine ";"Ten ";"Eleven ";"Twelve ";"Thirteen ";"Fourteen ";"Fifteen ";"Sixteen ";"Seventeen ";"Eighteen ";"Nineteen "},
MATCH(MOD(INT(B1/10^6),100),{0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19})
),
INDEX(
{"";"Twenty ";"Thirty ";"Fourty ";"Fifty ";"Sixty ";"Seventy ";"Eighty ";"Ninety "},
MATCH(INT(MOD(INT(B1/10^6),100)/10),{1;2;3;4;5;6;7;8;9})
)&
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(MOD(INT(B1/10^6),10),{0;1;2;3;4;5;6;7;8;9})
)
)&" Million ",
""
)&
IF(MOD(INT(B1/10^3),10^3)>0,
IF(INT(MOD(INT(B1/10^3),10^3)/100)>0,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(INT(MOD(INT(B1/10^3),10^3)/100),{0;1;2;3;4;5;6;7;8;9})
)&"Hundred ",
"")&
IF(MOD(INT(B1/10^3),100)<20,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine ";"Ten ";"Eleven ";"Twelve ";"Thirteen ";"Fourteen ";"Fifteen ";"Sixteen ";"Seventeen ";"Eighteen ";"Nineteen "},
MATCH(MOD(INT(B1/10^3),100),{0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19})
),
INDEX(
{"";"Twenty ";"Thirty ";"Fourty ";"Fifty ";"Sixty ";"Seventy ";"Eighty ";"Ninety "},
MATCH(INT(MOD(INT(B1/10^3),100)/10),{1;2;3;4;5;6;7;8;9})
)&
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(MOD(INT(B1/10^3),10),{0;1;2;3;4;5;6;7;8;9})
)
)&" Thousand ",
""
)&
IF(MOD(MOD(B1,10^4),10^3)>0,
IF(INT(MOD(MOD(B1,10^4),10^3)/100)>0,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(INT(MOD(MOD(B1,10^4),10^3)/100),{0;1;2;3;4;5;6;7;8;9})
)&"Hundred ",
""
)&
IF(MOD(MOD(MOD(B1,10^4),10^3),100)<20,
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine ";"Ten ";"Eleven ";"Twelve ";"Thirteen ";"Fourteen ";"Fifteen ";"Sixteen ";"Seventeen ";"Eighteen ";"Nineteen "},
MATCH(MOD(MOD(MOD(B1,10^4),10^3),100),{0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19})
),
INDEX(
{"";"Twenty ";"Thirty ";"Fourty ";"Fifty ";"Sixty ";"Seventy ";"Eighty ";"Ninety "},
MATCH(INT(MOD(MOD(MOD(B1,10^4),10^3),100)/10),{1;2;3;4;5;6;7;8;9})
)&
INDEX(
{"";"One ";"Two ";"Three ";"Four ";"Five ";"Six ";"Seven ";"Eight ";"Nine "},
MATCH(MOD(MOD(MOD(B1,10^4),10^3),10),{0;1;2;3;4;5;6;7;8;9})
)
),
""
),
""
) & " Rands"

关于excel - 将 Excel 值转换为单词(英文),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15065644/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com