英文:
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))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论