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?
 
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
Hi,How would you revise the same formula if it is from multiple worksheets.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi,How would you revise the same formula if it is from multiple worksheets.
You’d adjust each range to reference each worksheet/workbook’s range instead. O365 handles this nicely. ??
 
Upvote 0
I did but got Value error when I adjusted the range.
VBA Code:
UNIQUE(LET(ranges,(LAM!C6:C1188,PPI!C6:C1188,MPI!C6:C1188,ANUJ!C6:C1188),areas,AREAS(ranges),rows,ROWS(C6:C1188),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<>"")))
 
Upvote 0
You cannot index ranges on multiple sheets like that.

as you have started a new thread for your question Compile multiple worksheets data into one I will close this one.

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.
 
Last edited:
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,277
Messages
6,171,153
Members
452,383
Latest member
woodsfordg

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