复杂的合并在gsheets中

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

Complex Cocatenation in gsheets

问题

我有一个表格,其中我正在尝试连接几列,只有当所需的任何一个值都不为空时才应进行连接。

这是电子表格链接。https://docs.google.com/spreadsheets/d/1lQUG4TmFTKghV8r6Gg3EilLx6zyuTkrNfnCatRVWp_U/edit#gid=189998773

我尝试使用以下公式,但无法获得所需的输出。
=MAP(scan(,D5:D,I5:I,lambda(a,b,d,if(or(a="",b="",d="",and(e="",f="")),,if(f<>"",f,e)&" "&a&" "&b&" "&c))),D5:D,H5:H,I5:I,J5:J,K5:K,lambda(a,b,c,e,f,if(or(a="",b="",c="",and(e="",f="")),,if(f<>"",f,e)&" "&a&" "&b&" "&c)))

请帮助!

英文:

I have a table to entries where I am trying to concatenate few columns and the concatenation should not happen when any one of the required values are empty

Here is the spreadsheet. https://docs.google.com/spreadsheets/d/1lQUG4TmFTKghV8r6Gg3EilLx6zyuTkrNfnCatRVWp_U/edit#gid=189998773

I did try to use the formula =MAP(scan(,D5:D,I5:I,lambda(a,b,d,if(or(a="",b="",d="",and(e="",f="")),,if(f<>"",f,e)&" "&a&" "&b&" "&c))),D5:D,H5:H,I5:I,J5:J,K5:K,lambda(a,b,c,e,f,if(or(a="",b="",c="",and(e="",f="")),,if(f<>"",f,e)&" "&a&" "&b&" "&c)))

But not able to get the the desired output.
Please help!

答案1

得分: 2

您可以通过省略 SCAN 来简化您的公式

=MAP(D5:D,H5:H,I5:I,J5:J,K5:K,
      LAMBDA(dd,hh,ii,jj,kk,
       IF(OR(dd="",hh="",ii="",AND(jj="",kk="")),,dd&"-"&hh&"-"&ii&"-"&if(kk<>"",kk,jj))))

(供将来参考:尝试为您的 LAMBDA 函数适当命名)

复杂的合并在gsheets中

英文:

You can simplify your formula by omitting SCAN

=MAP(D5:D,H5:H,I5:I,J5:J,K5:K,
      LAMBDA(dd,hh,ii,jj,kk,
       IF(OR(dd=&quot;&quot;,hh=&quot;&quot;,ii=&quot;&quot;,AND(jj=&quot;&quot;,kk=&quot;&quot;)),,dd&amp;&quot;-&quot;&amp;hh&amp;&quot;-&quot;&amp;ii&amp;&quot;-&quot;&amp;if(kk&lt;&gt;&quot;&quot;,kk,jj))))

(for future reference: try naming your LAMBDAs accordingly)

复杂的合并在gsheets中

huangapple
  • 本文由 发表于 2023年6月1日 21:02:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76382178.html
匿名

发表评论

匿名网友

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

确定