简体   繁体   中英

Excel : How to merge two dynamic arrays into one dynamic array, with alternating rows?

I have two dynamic arrays, A1# and B1#. I want to combine them into a dynamic array, C1#, like so:

Column A Column B Column C
x 4 x
y 5 4
z 6 y
5...

Currently, I am using the solution provided via WeAreOne's answer to this , of which I have also seen a few different similar answers:

=IF(ISEVEN(ROW())=FALSE,INDEX($A$1:$A$3,ROUND((ROWS($A$1:A1)/2),0)),INDEX($B$1:$B$3,ROUND((ROWS($B$1:B1)/2),0)))

(entered into C1 and dragged down).

However, the arrays I am merging are often changing length drastically, and so I am looking for the neater solution of returning a dynamic array, rather than dragging down my current formula in anticipation of the merged array's length and also having to alter the references to the initial arrays.

Using TOCOL()

在此处输入图像描述


• Formula used in cell C2

=DROP(TOCOL(A:B,3),2)

As Ike Ma'am mentioned in comments, you can use it this way as well,

在此处输入图像描述


• Formula used in cell C2

=TOCOL(A2#:B2#,3)

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