Stacked multiple columns into one column ignoring blank and 0

ceecee88

Board Regular
Joined
Jun 30, 2022
Messages
59
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hi, this what I have got so far, I get it to stacked but it won't ignore blank (it is showing 0), I need it for older version, any suggestion please?

Thank you!

1656929172789.png
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Cheap and dirty way, if your formula works otherwise... put in
Excel Formula:
=IF(your formula=0,"",your formula)
.
 
Upvote 0
I need it for older version ....
Much easier in 365, of course.

Here's one horrible formula that should work in 2010:

ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7
8AA
9BB
10CC
11DD
12EE
13FF
14GG
15 
16 
17 
18
Sheet1
Cell Formulas
RangeFormula
B8:B17B8=IFERROR(INDEX(MyData,MOD(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$8:B8)),1000),INT(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$8:B8))/1000)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Named Ranges
NameRefers ToCells
MyData=Sheet3!$B$2:$E$5B8:B17
 
Upvote 0
Cheap and dirty way, if your formula works otherwise... put in
Excel Formula:
=IF(your formula=0,"",your formula)
.
Thank you, but I kinda need to row to adjust up when there is no value (blank), the mentioned formula will only make the 0 disappear but still having those excessive row. But thanks though ^^
 
Upvote 0
Much easier in 365, of course.

Here's one horrible formula that should work in 2010:

ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7
8AA
9BB
10CC
11DD
12EE
13FF
14GG
15 
16 
17 
18
Sheet1
Cell Formulas
RangeFormula
B8:B17B8=IFERROR(INDEX(MyData,MOD(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$8:B8)),1000),INT(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$8:B8))/1000)),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Named Ranges
NameRefers ToCells
MyData=Sheet3!$B$2:$E$5B8:B17
 
Last edited by a moderator:
Upvote 0
The first step in the formula is to create an array that I can sort using the SMALL function. 1,000 is a slightly arbitrary number - it just needs to be sufficiently large to get the sort in the right order. In this simple case, we would use 10 instead of 1,000, so by using 1,000 I have included some wiggle room in case your actual sample is much bigger.

If you're using Excel 2010, you won't see the formulae in B17 and B24 spill like this, but it will illustrate what's happening.

ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7AA
8BB
9CC
10DD
11EE
12FF
13GG
14
15Stack
16by column
1711FALSEFALSE41
1812FALSEFALSE42
19FALSE23FALSEFALSE
2014FALSE34FALSE
21
22Stack
23by row
2411FALSEFALSE14
2521FALSEFALSE24
26FALSE32FALSEFALSE
2741FALSE43FALSE
28
Sheet1
Cell Formulas
RangeFormula
B7:B13B7=IFERROR(INDEX(MyData,MOD(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7)),1000),INT(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7))/1000)),"")
B17:E20B17=IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+10*(1+COLUMN(MyData)-MIN(COLUMN(MyData))))
B24:E27B24=IF(LEN(MyData),10*(1+ROW(MyData)-MIN(ROW(MyData)))+1+COLUMN(MyData)-MIN(COLUMN(MyData)))
Press CTRL+SHIFT+ENTER to enter array formulas.
Dynamic array formulas.
Named Ranges
NameRefers ToCells
MyData=Sheet3!$B$2:$E$5B24, B17, B7:B13
 
Upvote 0
The first step in the formula is to create an array that I can sort using the SMALL function. 1,000 is a slightly arbitrary number - it just needs to be sufficiently large to get the sort in the right order. In this simple case, we would use 10 instead of 1,000, so by using 1,000 I have included some wiggle room in case your actual sample is much bigger.

If you're using Excel 2010, you won't see the formulae in B17 and B24 spill like this, but it will illustrate what's happening.

ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7AA
8BB
9CC
10DD
11EE
12FF
13GG
14
15Stack
16by column
1711FALSEFALSE41
1812FALSEFALSE42
19FALSE23FALSEFALSE
2014FALSE34FALSE
21
22Stack
23by row
2411FALSEFALSE14
2521FALSEFALSE24
26FALSE32FALSEFALSE
2741FALSE43FALSE
28
Sheet1
Cell Formulas
RangeFormula
B7:B13B7=IFERROR(INDEX(MyData,MOD(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7)),1000),INT(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7))/1000)),"")
B17:E20B17=IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+10*(1+COLUMN(MyData)-MIN(COLUMN(MyData))))
B24:E27B24=IF(LEN(MyData),10*(1+ROW(MyData)-MIN(ROW(MyData)))+1+COLUMN(MyData)-MIN(COLUMN(MyData)))
Press CTRL+SHIFT+ENTER to enter array formulas.
Dynamic array formulas.
Named Ranges
NameRefers ToCells
MyData=Sheet3!$B$2:$E$5B24, B17, B7:B13
Thank you so much, I'll study for it. Probably need a bit of research and a time to digest. ^^
 
Upvote 0
The first step in the formula is to create an array that I can sort using the SMALL function. 1,000 is a slightly arbitrary number - it just needs to be sufficiently large to get the sort in the right order. In this simple case, we would use 10 instead of 1,000, so by using 1,000 I have included some wiggle room in case your actual sample is much bigger.

If you're using Excel 2010, you won't see the formulae in B17 and B24 spill like this, but it will illustrate what's happening.

ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7AA
8BB
9CC
10DD
11EE
12FF
13GG
14
15Stack
16by column
1711FALSEFALSE41
1812FALSEFALSE42
19FALSE23FALSEFALSE
2014FALSE34FALSE
21
22Stack
23by row
2411FALSEFALSE14
2521FALSEFALSE24
26FALSE32FALSEFALSE
2741FALSE43FALSE
28
Sheet1
Cell Formulas
RangeFormula
B7:B13B7=IFERROR(INDEX(MyData,MOD(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7)),1000),INT(SMALL(IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+1000*(1+COLUMN(MyData)-MIN(COLUMN(MyData)))),ROWS(B$7:B7))/1000)),"")
B17:E20B17=IF(LEN(MyData),1+ROW(MyData)-MIN(ROW(MyData))+10*(1+COLUMN(MyData)-MIN(COLUMN(MyData))))
B24:E27B24=IF(LEN(MyData),10*(1+ROW(MyData)-MIN(ROW(MyData)))+1+COLUMN(MyData)-MIN(COLUMN(MyData)))
Press CTRL+SHIFT+ENTER to enter array formulas.
Dynamic array formulas.
Named Ranges
NameRefers ToCells
MyData=Sheet3!$B$2:$E$5B24, B17, B7:B13
One quick questions, when you are saying I could use 10 in this example because there is only less than 10 results? the number using is the estimate of number of result? Am I understand that correctly?
 
Upvote 0
Does the order matter? If not, this is somewhat less 'horrible' than Stephen's and should also work in 2010.

22 07 05.xlsm
ABCDE
1
2AAFF
3BBGG
4DD
5CCEE
6
7
8AA
9FF
10BB
11GG
12DD
13CC
14EE
15 
16 
To Column
Cell Formulas
RangeFormula
B8:B16B8=IFERROR(INDIRECT(TEXT(AGGREGATE(15,6,(ROW(B$2:E$5)*10^6+COLUMN(B$2:E$5))/(B$2:E$5<>""),ROWS(B$8:B8)),"R000000C000000"),0),"")
 
Upvote 0

Forum statistics

Threads
1,223,731
Messages
6,174,173
Members
452,548
Latest member
Enice Anaelle

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