Stacking multiple nonadjacent columns into one (best practice)

Status
Not open for further replies.

xlyfe

Board Regular
Joined
Aug 28, 2020
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm looking for some guidance on how to efficiently take the data from multiple nonadjacent columns, and place it into one long continuous column, while ignoring all blanks in the process.
The new stacked column would look like a stacked version of the columns being used to copy from, but without the blank spaces.
The "copied from" columns are variable in length. They could consist of zero rows, 1 row, or hundreds of rows.

Below is an example of this scenario...

Book1
DEFGHIJKLM
8Col 1Col2Col 3Stacked
9asdposdopksisj3asd
101dfgi43591dfg
115ero238duyhlskdj25er
123699g73hdh87gsd3699g
1302kjfgposdop
14067'fdeki4359
1563hdo238duyh
16jsdfjd873hdh
1742gsdjk342jkl02kjfg
18uiew78342067'fdek
19jsdfjd8
2042gsd
21kjsdkj8ksisj3
22lskdj2
2387gsd
24k984363hd
25jk342jkl
26uiew78342
27kjsdkj8
28k9843
Sheet1


What would be the best way for me to approach getting that "Stacked" column to populate itself automatically in that format shown there?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
So I do have some methods to achieve my end result but was hoping to see some fresh ideas on how the guru's here would go about this problem in hopes of learning more advanced and efficient techniques.

Any support that anyone can provide is greatly appreciated. :)
 
Upvote 0
Unfortunately, Excel tables can’t be used in this scenario. Only formulas or VBA due to the structure of my actual workbook.

Thank you so much for your reply tho Sandy!
 
Upvote 0
Maybe this video will help. Stacking columns with formulas is a tough task. I hear that MS is working on it, though.

 
Upvote 0
Unfortunately, Excel tables can’t be used in this scenario. Only formulas or VBA due to the structure of my actual workbook.

Thank you so much for your reply tho Sandy!
no problem
have a nice day

btw. there can be used named range instead of Excel Table but problem will be with updates about new data
 
Last edited:
Upvote 0
If the other columns will be blank, have a look here
 
Upvote 0
If you have the new LET function, another option is
+Fluff v2.xlsm
DEFGHIJKLMN
8Col 1Col2Col 3Stacked
9asdposdopksisj3asdasd
101dfgi43591dfg1dfg
115ero238duyhlskdj25er5er
123699g73hdh87gsd3699g3699g
1302kjfgposdopposdop
14067'fdeki4359i4359
1563hdo238duyho238duyh
16jsdfjd873hdh73hdh
1742gsdjk342jkl02kjfg02kjfg
18uiew78342067'fdek067'fdek
19jsdfjd8jsdfjd8
2042gsd42gsd
21kjsdkj8ksisj3ksisj3
22lskdj2lskdj2
2387gsd87gsd
24k984363hd63hd
25jk342jkljk342jkl
26uiew78342uiew78342
27kjsdkj8kjsdkj8
28k9843k9843
Main
Cell Formulas
RangeFormula
N9:N28N9=UNIQUE(LET( ranges, (D9:D50,G9:G50,J9:J50), areas, AREAS(ranges), rows, ROWS(D9:D50), TotalRows, SEQUENCE(areas*rows), NumArea, CEILING.MATH(SEQUENCE(areas*rows),rows)/rows, Row, TotalRows-(NumArea-1)*rows, indx,INDEX(ranges,Row,1,NumArea),FILTER(indx,indx<>"")))
Dynamic array formulas.


Formula taken from here https://www.myonlinetraininghub.com/excel-forum/excel/unique-values-from-two-sources
 
Upvote 0
Solution
If you have the new LET function, another option is
+Fluff v2.xlsm
DEFGHIJKLMN
8Col 1Col2Col 3Stacked
9asdposdopksisj3asdasd
101dfgi43591dfg1dfg
115ero238duyhlskdj25er5er
123699g73hdh87gsd3699g3699g
1302kjfgposdopposdop
14067'fdeki4359i4359
1563hdo238duyho238duyh
16jsdfjd873hdh73hdh
1742gsdjk342jkl02kjfg02kjfg
18uiew78342067'fdek067'fdek
19jsdfjd8jsdfjd8
2042gsd42gsd
21kjsdkj8ksisj3ksisj3
22lskdj2lskdj2
2387gsd87gsd
24k984363hd63hd
25jk342jkljk342jkl
26uiew78342uiew78342
27kjsdkj8kjsdkj8
28k9843k9843
Main
Cell Formulas
RangeFormula
N9:N28N9=UNIQUE(LET( ranges, (D9:D50,G9:G50,J9:J50), areas, AREAS(ranges), rows, ROWS(D9:D50), TotalRows, SEQUENCE(areas*rows), NumArea, CEILING.MATH(SEQUENCE(areas*rows),rows)/rows, Row, TotalRows-(NumArea-1)*rows, indx,INDEX(ranges,Row,1,NumArea),FILTER(indx,indx<>"")))
Dynamic array formulas.


Formula taken from here https://www.myonlinetraininghub.com/excel-forum/excel/unique-values-from-two-sources
This is genius. Thank you for sharing this. ?
Removing the UNIQUE wrapper will generate a non-unique stacked list too. Such a flexible formula.
 
Last edited:
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top