简体   繁体   中英

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.

=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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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