REPT引发“ REPT的文本结果长于32000个字符的限制。”错误-替代功能?

时间:2019-06-25 11:39:33

标签: google-sheets concatenation google-sheets-formula array-formulas google-sheets-query

我正在尝试重复两次用逗号分隔的集合值,导致该集合超过REPT允许的32000个字符的限制。

有没有办法使用替代方法(例如javascript或使用查询功能)?

我已经尝试构建一个复制此脚本的Google脚本功能,但引发了无法解决的内部自定义JavaScript错误。

这是功能: =REPT(JOIN(",",ARRAYFORMULA(REPT(SPLIT("1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,1323,1330,1331,1342,1345,1350,1355,1360,1380,1390",",")&",",19))),40)

这是错误:

  

REPT的文本结果超出了32000个字符的限制。

2 个答案:

答案 0 :(得分:0)

首先,请确保您真的知道自己需要它

您的公式太大,但是如果将 40 更改为 8 ,它将起作用:

=ARRAYFORMULA(REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8))

所以现在您只需要将其堆叠在VR阵列中5次:

=ARRAYFORMULA(QUERY({REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8);
 REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8);
 REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8);
 REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8);
 REPT(JOIN(",", REPT(SPLIT(
 "1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,
  1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,
  1323,1330,1331,1342,1345,1350,1355,1360,1380,1390", ",")&",", 19)), 8)},,999^99))

0

答案 1 :(得分:0)

SPLIT将文本转换为数字,而REPT仅适用于文本。

因此请考虑颠倒顺序;

  • 重复字符串
  • 然后将其拆分

=split(rept("1010,1020,1050,1051,1052,1060,1070,1080,1081,1090,1091,1092,1093,1094,1100,1120,1150,1180,1200,1240,1250,1260,1280,1290,1300,1301,1310,1312,1320,1321,1323,1330,1331,1342,1345,1350,1355,1360,1380,1390,",2),",",true,true)