有人可以帮我编写Google表格功能吗?
需要完成的Google表格示例:
第一列可以用 X行填充,每行中各有一个名称。
在该名称中,“目标”和“源”列将填充名称之间的所有可能组合,无需重复输入对(如果您已经有“ Gustavo | Jacinto”,则不需要“ Jacinto | Gustavo”。
我知道我可以使用python和其他工具解决此问题,但我想使用Google表格的功能来解决此问题,因为这样可以更快地获得所需的响应。
答案 0 :(得分:1)
=QUERY(ARRAYFORMULA(SPLIT(
TRANSPOSE(SPLIT(REPT(CONCATENATE(A2:A&CHAR(9)), COUNTA(A2:A)), CHAR(9)))& " "&
TRANSPOSE(SPLIT(CONCATENATE(REPT(A2:A&CHAR(9), COUNTA(A2:A))), CHAR(9))), " ")),
"where Col1<>Col2 order by Col1", 0)
答案 1 :(得分:0)
=ARRAYFORMULA(SPLIT(SORT(
TRANSPOSE(SPLIT(CONCATENATE(REPT(UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))&","&
TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))), (
UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))<=
TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))))*
REGEXMATCH(CONCATENATE(","&SUBSTITUTE(TEXTJOIN(",",1,A2:A),",",",,")&","&CHAR(9)),"(,"&
UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))&",[^\t]*,"&
TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),","))))&",)|(,"&
TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),","))))&",[^\t]*,"&
UNIQUE(TRANSPOSE(SPLIT(JOIN(",",TEXTJOIN(",",1,A2:A)),",")))&",)"))&CHAR(9)),CHAR(9)))),","))