公式在选择大量单元格时无法正常工作。

huangapple go评论60阅读模式
英文:

Formula isn't working when selecting a large amount of cells

问题

I have the following formula:

=TEXTSPLIT(TEXTJOIN(";", 1, "cd " & $A$2 & "|git submodule add " & components!C1:C100 & " " & components!A1:A100 & "|git submodule update --init --recursive " & components!A1:A100 & "|cd " & components!A1:A100 & "|git checkout --recurse-submodules " & components!B1:B100), ";")

To make it simple, the purpose of it is to create commands to automatically add a submodule into my local repository, given a submodule path, commit ID, and URL.

For example, given these submodule details (path, commit ID, URL):

公式在选择大量单元格时无法正常工作。

The formula will output the following. Which makes it easy for me to then create a bat file of it and run it:

公式在选择大量单元格时无法正常工作。

But the problem with this formula is that whenever I give it a number of submodules that is large (around 90), it breaks, and I get a #CALC as output instead.

Any help in tweaking the formula to accommodate a large number of submodules is appreciated.

英文:

I have the following formula:

=TEXTSPLIT(TEXTJOIN("|",1,"cd "&$A$2&"|git submodule add "&components!C1:C100&" "&components!A1:A100&"|git submodule update --init --recursive " &components!A1:A100&"|cd " &components!A1:A100&"|git checkout --recurse-submodules "&components!B1:B100),,"|")

To make it simple, the purpose of it is to create commands to automatically add a submodule into my local repository, given a submodule path, commit ID and URL.

For example, given these submodule details (path, commit ID, URL):

公式在选择大量单元格时无法正常工作。

The formula will output the following. Which makes it easy for me to then create a bat file of it and run it:

公式在选择大量单元格时无法正常工作。

But the problem with this formula is that whenever I give it a number of submodules that is large (around 90), it breaks and I get a #CALC as output instead.

Any help in tweaking the formula to accommodate a large numbers of submodules is appreciated.

答案1

得分: 1

=LET(a,components!A1:A100,
b,components!B1:B100,
c,components!C1:C100,
DROP(REDUCE("",SEQUENCE(ROWS(a)),
LAMBDA(x,y,
VSTACK(x,
TEXTSPLIT(TEXTJOIN("|",1,"cd "&$A$2&"|git submodule add "&INDEX(c,y)&" "&INDEX(a,y)&"|git submodule update --init --recursive "&INDEX(a,y)&"|cd "&INDEX(a,y)&"|git checkout --recurse-submodules "&INDEX(b,y))),,"|"))),
1))

英文:

As commented by Harun24hr TEXTJOIN has a character limit and joining all the text into 1 large string results in meeting the limits.

You could involve REDUCE to not stack all into a single string, but stack the necessary strings line by line and perform the split after completing the first line, then the next, etc.

=LET(a,components!A1:A100,
     b,components!B1:B100,
     c,components!C1:C100,
DROP(REDUCE("",SEQUENCE(ROWS(a)),
     LAMBDA(x,y,
            VSTACK(x,
                   TEXTSPLIT(TEXTJOIN("|",1,"cd "&$A$2&"|git submodule add "&INDEX(c,y)&" "&INDEX(a,y)&"|git submodule update --init --recursive " &INDEX(a,y)&"|cd " &INDEX(a,y)&"|git checkout --recurse-submodules "&INDEX(b,y)),,"|")))),
     1))

huangapple
  • 本文由 发表于 2023年6月12日 11:09:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76453435.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定