Stacking Multiple Columns ignoring 0 and blanks

Shiftywicket

New Member
Joined
Oct 10, 2013
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi, I was looking at an old topic from 2014 and I am trying to extend an array formula to stack data from 9 columns ignoring 0 and blanks.
My workings are in below screenshot;
1691242800635.png


and sample data is as below;
Book1
ABCDEFGHIJKLMNOPQR
1170000000
2232563Entity 1Entity 2Entity 3Entity 4Entity 5Entity 6Entity 7Entity 8All SAP #
3539115232563.539115.BIF($AQ$1>=ROWS(BH$3:BH3),INDEX(AQ:AQ,SMALL(IF($AQ$3:$AQ$500<>0,ROW($AQ$3:$AQ$500)),ROWS(BH$3:BH3))),IF($AQ$1+$AR$1>=ROWS(BH$3:BH3),INDEX(AR:AR,SMALL(IF($AR$3:$AR$500<>0,ROW($AR$3:$AR$500)),ROWS(BH$3:BH3)-$AQ$1))),IF($AQ$1+$AR$1+$AS$1>=ROWS(BH$3:BH3),INDEX(AS:AS,SMALL(IF($As$3:$As$500<>0,ROW($As$3:$As$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1>=ROWS(BH$3:BH3),INDEX(AT:AT,SMALL(IF($AT$3:$AT$500<>0,ROW($AT$3:$AT$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1)))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1>=ROWS(BH$3:BH3),INDEX(AU:AU,SMALL(IF($AU$3:$AU$500<>0,ROW($AU$3:$AU$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1>=ROWS(BH$3:BH3),INDEX(AV:AV,SMALL(IF($AV$3:$AV$500<>0,ROW($AV$3:$AV$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1)))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1>=ROWS(BH$3:BH3),INDEX(AW:AW,SMALL(IF($AW$3:$AW$500<>0,ROW($AW$3:$AW$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1+$AX$1>=ROWS(BH$3:BH3),INDEX(AX:AX,SMALL(IF($AX$3:$AX$500<>0,ROW($AX$3:$AX$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1)))),""))
4539115232563.539115.B
5539115232563.539115.B
6539115232563.539115.B
7539115232563.539115.B
8559437232563.559437.B
9559437232563.559437.B
10559437232563.559437.B
11559437232563.559437.B
12559437232563.559437.B
13586977232563.586977.B
14586977232563.586977.B
15586977232563.586977.B
16586977232563.586977.B
17597069232563.597069.B
18597069232563.597069.B
19597069232563.597069.B
Sheet1



The blank cells are either blank or 0s which have been told to show as blank
I am trying to stack A3:A500, B3:B500 Until H3:H500 starting in R3

The formula in R3 is rather monstrous (run as an array);

=IF($AQ$1>=ROWS(BH$3:BH3),INDEX(AQ:AQ,SMALL(IF($AQ$3:$AQ$500<>0,ROW($AQ$3:$AQ$500)),ROWS(BH$3:BH3))),IF($AQ$1+$AR$1>=ROWS(BH$3:BH3),INDEX(AR:AR,SMALL(IF($AR$3:$AR$500<>0,ROW($AR$3:$AR$500)),ROWS(BH$3:BH3)-$AQ$1))),IF($AQ$1+$AR$1+$AS$1>=ROWS(BH$3:BH3),INDEX(AS:AS,SMALL(IF($As$3:$As$500<>0,ROW($As$3:$As$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1>=ROWS(BH$3:BH3),INDEX(AT:AT,SMALL(IF($AT$3:$AT$500<>0,ROW($AT$3:$AT$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1)))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1>=ROWS(BH$3:BH3),INDEX(AU:AU,SMALL(IF($AU$3:$AU$500<>0,ROW($AU$3:$AU$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1>=ROWS(BH$3:BH3),INDEX(AV:AV,SMALL(IF($AV$3:$AV$500<>0,ROW($AV$3:$AV$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1)))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1>=ROWS(BH$3:BH3),INDEX(AW:AW,SMALL(IF($AW$3:$AW$500<>0,ROW($AW$3:$AW$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1))),IF($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1+$AX$1>=ROWS(BH$3:BH3),INDEX(AX:AX,SMALL(IF($AX$3:$AX$500<>0,ROW($AX$3:$AX$500)),ROWS(BH$3:BH3)-($AQ$1+$AR$1+$AS$1+$AT$1+$AU$1+$AV$1+$AW$1)))),""))

I think I may have some punctuation out of place. Any assistance greatly appreciated. The legacy topic is here: Stacking multiple columns into one column without including 0 or Blanks

Many thanks in advance for your help
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Aha!
1691327124929.png
 

Attachments

  • 1691327009122.png
    1691327009122.png
    30.3 KB · Views: 11
  • 1691327109248.png
    1691327109248.png
    30.3 KB · Views: 11
Upvote 0
Thanks for that, how about
Fluff.xlsm
AQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBH
1171200000
2232563123Entity 1Entity 2Entity 3Entity 4Entity 5Entity 6Entity 7Entity 8
3539115abc232563.539115.B539115
4539115232563.539115.B539115
55391150232563.539115.B539115
65391156789232563.539115.B539115
7539115232563.539115.B539115
8559437232563.559437.B559437
9559437232563.559437.B559437
10559437232563.559437.B559437
11559437232563.559437.B559437
12559437232563.559437.B559437
13586977232563.586977.B586977
14586977232563.586977.B586977
15586977232563.586977.B586977
16586977232563.586977.B586977
17597069232563.597069.B597069
18597069232563.597069.B597069
19597069232563.597069.B597069
20abc
216789
22
Data
Cell Formulas
RangeFormula
BH3:BH21BH3=LET(x,TOCOL(AQ3:AX500,1,1),FILTER(x,(x<>0)*(x<>"")))
Dynamic array formulas.


Please don't forget to update your profile to show you are using 365. ;)
 
Upvote 0
Solution
That is a beautiful, elegant and generally sexy solution to my problem. I was not familiar enough with the LET and TOCOL functions to put it together so I am very grateful.
I shall update my profile immediately. For you :-)
Have an awesome day! You have made tomorrow a lot easier for me :-)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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