[GoogleSheets-使用行号的Arrayformula中的Concat

问题描述 投票:0回答:1

似乎无法找到完成此任务的其他任何地方,也很高兴评论中的任何链接:)

我有一列文字,超过一百个文件的内容,每个文件的顶部都是[task]

[超过50,000个字符,因此它们将每个单元格粘贴到换行符(“粘贴为值”)。

我可以很容易地告诉行号,并且有一个可拖动的工作公式,只是不能正确获得它[支持ARRAYFORMULA,因为输入可能会轻易改变一千行,因此需要妥善处理。 >

请仅公式,无代码

示例电子表格

https://docs.google.com/spreadsheets/d/1yaETa3Pvq47DpcAyojSlf6p5N1Tt_hpvoqp7WEtC6pI/edit?usp=sharing

示例输入(50,000个字符)

https://drive.google.com/file/d/1sMl0ZQfbXZUjpB0fic2VkX5Ze5H_IEGL/view?usp=sharing

注意-如果在清理驱动器时删除了输入文件,只需将以下示例复制粘贴到50,000个以上的字符,或查看链接的电子表格

输入

[task] SpriteNE = floor_metal_01.dds SpriteSE = floor_metal_01.dds SpriteSW = floor_metal_01.dds SpriteNW = floor_metal_01.dds guilevel = 1 guiindex = 10 type = COMPONENT locked = 0 name = category_advanced_manufacturing parent [task] SpriteNE = floor_metal_01.dds SpriteSE = floor_metal_01.dds SpriteSW = floor_metal_01.dds SpriteNW = floor_metal_01.dds guilevel = 1 guiindex = 9 type = COMPONENT locked = 0 name = category_facilities parent [task] tilelable SpriteNE = conveyor_NE.dds SpriteSE = conveyor_SE.dds SpriteSW = conveyor_SW.dds SpriteNW = conveyor_NW.dds exitdirectionoffsets = 0 inputdirectionoffsets = 2 guilevel = 1 parent guiindex = 0.5 name = task_conveyor is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_SE.dds [task] tilelable SpriteNE = conveyor_converge3_NE.dds SpriteSE = conveyor_converge3_SE.dds SpriteSW = conveyor_converge3_SW.dds SpriteNW = conveyor_converge3_NW.dds exitdirectionoffsets = 0, inputdirectionoffsets = 1,2,3 guilevel = -1 parent guiindex = 1 name = task_conveyor_converge3 is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_converge3_SE.dds [task] tilelable SpriteNE = conveyor_crossover_NE.dds SpriteSE = conveyor_crossover_SE.dds SpriteSW = conveyor_crossover_SW.dds SpriteNW = conveyor_crossover_NW.dds exitdirectionoffsets = 0,3 inputdirectionoffsets = 1,2 guilevel = -1 parent guiindex = 1 name = task_conveyor_crossover is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_crossover_SE.dds [task] tilelable SpriteNE = conveyor_left_NE.dds SpriteSE = conveyor_left_SE.dds SpriteSW = conveyor_left_SW.dds SpriteNW = conveyor_left_NW.dds exitdirectionoffsets = 3 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_left is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_left_SE.dds [task] tilelable SpriteNE = conveyor_right_NE.dds SpriteSE = conveyor_right_SE.dds SpriteSW = conveyor_right_SW.dds SpriteNW = conveyor_right_NW.dds exitdirectionoffsets = 1 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_right is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_right_SE.dds [task] tilelable SpriteNE = conveyor_split3_NE.dds SpriteSE = conveyor_split3_SE.dds SpriteSW = conveyor_split3_SW.dds SpriteNW = conveyor_split3_NW.dds exitdirectionoffsets = 0,1,3 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_split3 is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_split3_SE.dds [task] tilelable SpriteNE = conveyor_t_NE.dds SpriteSE = conveyor_t_SE.dds SpriteSW = conveyor_t_SW.dds SpriteNW = conveyor_t_NW.dds exitdirectionoffsets = 3,1 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_t is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_SE.dds [task] tilelable SpriteNE = conveyor_t_join_NE.dds SpriteSE = conveyor_t_join_SE.dds SpriteSW = conveyor_t_join_SW.dds SpriteNW = conveyor_t_join_NW.dds exitdirectionoffsets = 0 inputdirectionoffsets = 1,3 guilevel = -1 parent guiindex = 1 name = task_conveyor_t_join is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_join_SE.dds [task] tilelable SpriteNE = conveyor_t_join_left_NE.dds SpriteSE = conveyor_t_join_left_SE.dds SpriteSW = conveyor_t_join_left_SW.dds SpriteNW = conveyor_t_join_left_NW.dds exitdirectionoffsets = 0 inputdirectionoffsets = 2,3 guilevel = -1 parent guiindex = 1 name = task_conveyor_t_join_left is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_join_left_SE.dds [task] tilelable SpriteNE = conveyor_t_join_right_NE.dds SpriteSE = conveyor_t_join_right_SE.dds SpriteSW = conveyor_t_join_right_SW.dds SpriteNW = conveyor_t_join_right_NW.dds exitdirectionoffsets = 0 inputdirectionoffsets = 1,2 guilevel = -1 parent guiindex = 1 name = task_conveyor_t_join_right is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_join_right_SE.dds [task] tilelable SpriteNE = conveyor_t_left_NE.dds SpriteSE = conveyor_t_left_SE.dds SpriteSW = conveyor_t_left_SW.dds SpriteNW = conveyor_t_left_NW.dds exitdirectionoffsets = 0,3 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_t_left is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_left_SE.dds [task] tilelable SpriteNE = conveyor_t_right_NE.dds SpriteSE = conveyor_t_right_SE.dds SpriteSW = conveyor_t_right_SW.dds SpriteNW = conveyor_t_right_NW.dds exitdirectionoffsets = 0,1 inputdirectionoffsets = 2 guilevel = -1 parent guiindex = 1 name = task_conveyor_t_right is_conveyor = 1 [components] [resources] [subtasksrequired] [subtasksapplied] [tile] texture = conveyor_t_right_SE.dds

所需的输出

[每个[task]。*是一个新文件,因此请按文件/任务将其分成一个字符串/行,并以换行符(\n)作为内部分隔符。

当前输出

获取行号

$D$1:D是输入列

$G$1被下拉并选择了"[task]"

$M$1 =ARRAYFORMULA(QUERY({$D1:$D, row($D1:$D)},"select * where Col1 = '"&$G$1&"'"))

$O$1 =ARRAYFORMULA(QUERY({$M1:$M,{$M2:$M;0}},"select *"))
然后是我尝试使用这些数字的一些尝试

Works,但是必须拖动,并且没有任何分隔符

=ARRAYFORMULA(CONCATENATE(INDIRECT("$D"&$O1:$O&":$D"&$P1:$P-1)))

没有工作,我不断添加更多的arrayformula,但仍然只是第一个结果

=ARRAYFORMULA(IF($P1:P<>"",CONCATENATE(ARRAYFORMULA(INDIRECT("$D"&ARRAYFORMULA(INDIRECT("$O"&IF($P1:$P<>"",row($P1:$P),"")&":$O"))&":$D"&ARRAYFORMULA(INDIRECT("$P"&IF($P1:$P<>"",row($P1:$P),"")&":$P"))-1))),""))

只是上一个INDIRECT中使用的字符串

=ARRAYFORMULA(IF($O1:O<>"","$D"&ARRAYFORMULA(INDIRECT("$O"&IF($P1:$P<>"",row($P1:$P),"")&":$O"))&":$D"&ARRAYFORMULA(INDIRECT("$P"&IF($P1:$P<>"",row($P1:$P),"")&":$P"))-1,""))

不起作用,有分隔符,但仍然只循环第一个结果。

$U1:U是间接字符串的列表(见上文)

=ARRAYFORMULA(IF($U1:U<>"",TEXTJOIN(";",FALSE,INDIRECT($U1:U)),""))

[示例表中还有其他一些公式,但我一直沿用,因此大部分都删除了哑巴。

[我发现了很多有趣的资源,但似乎没有使用行号作为目标的东西,甚至什至只是SPLIT + JOIN类型的方法都允许使用ARRAYFORMULA

并且避免了50,000个字符限制

问题,使用单个CONCAT或类似方法电话)。
无法在其他地方找到可以完成的操作,因此也很高兴评论中的任何链接:)我有一列文字,每个文件的顶部都有[任务]上百个文件的内容。超过50,000 ...
google-sheets spreadsheet google-sheets-formula array-formulas google-sheets-query
1个回答
0
投票
尝试:
© www.soinside.com 2019 - 2024. All rights reserved.