简体   繁体   English

在 Excel 中将六列合并为一列

[英]Spill merging six columns into one column in Excel

So I have managed to find and workout how the following line of formula works but whenever I attempt to add onto it I seem to be scratching my head and can't figure out how to get it to work with another four columns.所以我设法找到并锻炼了以下公式的工作原理,但每当我尝试添加它时,我似乎都在摸不着头脑,无法弄清楚如何让它与另外四列一起工作。 I have tried IFERROR but then it just comes up ass blank after the first column even when there are different values in the second column.我已经尝试过 IFERROR 但即使第二列中有不同的值,它也会在第一列之后出现空白。

=IF(SEQUENCE(COUNTA(A:A)+COUNTA(C:C))<COUNTA(A:A)+1,INDEX(A:A,SEQUENCE(COUNTA(A:A)+COUNTA(C:C))),INDEX(C:C,SEQUENCE(COUNTA(A:A)+COUNTA(C:C))-COUNTA(A:A)))

If you use this formula instead it is easier to expand:如果您使用此公式,则更容易扩展:

=FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,A:A,C:C)&"</s></t>","//s")

for example to this: (didnt know which columns to use)例如:(不知道要使用哪些列)

=FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,A:A,B:B,C:C,D:D,E:E,F:F)&"</s></t>","//s")

This way you can also, if needed, apply text filters as described in this article: Excel - Extract substring(s) from string using FILTERXML which contains examples for removing duplicates, substituting letters, showing only numerical elements, etc.这样,如果需要,您还可以按照本文所述应用文本过滤器: Excel - 使用 FILTERXML 从字符串中提取子字符串,其中包含删除重复项、替换字母、仅显示数字元素等的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM