Formula to pull non 0 cells to a list

bearcub

Well-known Member
Joined
May 18, 2005
Messages
734
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I have a file where I have to copy the numbers from a row format to a column format. Is there a formula to retrieve non zero amounts from a row to column format. Is there a way to filter out the zero amounts from appearing in the list without having to delete them from the file.

In the table below I have customers that have purchased some of services (e.g. New Business, renewals, services, New MultiYear and Renewal MultiYear orders).

I have like the New New to show in Row 1, Renewal - 192,868 in the Row 2, Renewal in 38,215 in Row 3, New 223,892 in Row 4, etc. In other words, the I want the zero values to be ignored and not copied down into the transposed list.

Thank you for your help.

1665201548536.png


I would have used the Xl2bb tool but it is disabled from my computer. Seems my computer is automatically disabling macros and I don't know now to fix this yet. Just happened this last week.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Is this the sort of thing you are trying to do?

bearcub.xlsm
ABCDEFGHI
1
23100203
30021231
40210122
50000002
60031121
72
83
92
101
111
122
133
141
151
162
17
Sheet1
Cell Formulas
RangeFormula
I2:I16I2=TEXTSPLIT(TEXTJOIN(" ",1,IF(B2:G6=0,"",B2:G6)),," ")
Dynamic array formulas.
 
Upvote 0
Hi Peter,

No, it isn't sorted. If it needed to be sorted how would that work

I tried your format and totally amazing. I just saved myself about 30 minutes of work.

Another issue I have is i need to put the associated customer name next to value. Is that possible
 
Upvote 0
No sorting needed (I think you misunderstood what Peter was saying), how about
Fluff.xlsm
ABCDEFGHIJ
1
2A310020A3
3B002123A1
4C021012A2
5D000000B2
6E003112B1
7B2
8B3
9C2
10C1
11C1
12C2
13E3
14E1
15E1
16E2
17
Main
Cell Formulas
RangeFormula
I2:J16I2=LET(Data,B2:G6,c,COLUMNS(Data),s,SEQUENCE(c*ROWS(Data),,0),tc,TOCOL(Data),hs,HSTACK(INDEX(A2:A6,INT(s/c)+1),tc),FILTER(hs,tc<>0))
Dynamic array formulas.
 
Upvote 0
Yes, you're right. I didn't read his comment correctly, sorry.

Your answer is fantastic. How you do folks come up with all these great formulas - it's like magic (as Bob Umlas was wont to say).
 
Upvote 0
Another issue I have is i need to put the associated customer name next to value. Is that possible
Another way

bearcub.xlsm
ABCDEFGHIJ
1
2A310020A3
3B002123A1
4C021012A2
5D000000B2
6E003112B1
7B2
8B3
9C2
10C1
11C1
12C2
13E3
14E1
15E1
16E2
17
Sheet2
Cell Formulas
RangeFormula
I2:J16I2=LET(n,B2:G6,tcn,TOCOL(n),FILTER(CHOOSE({1,2},TOCOL(IF(n,A2:A6)),tcn),tcn))
Dynamic array formulas.
 
Upvote 0
Incredible! Thank you both very much. It is fascinating to figure out how each piece of the formula works.
 
Upvote 0
Probably should have used HSTACK instead of CHOOSE ..

bearcub.xlsm
ABCDEFGHIJ
1
2A310020A3
3B002123A1
4C021012A2
5D000000B2
6E003112B1
7B2
8B3
9C2
10C1
11C1
12C2
13E3
14E1
15E1
16E2
17
Sheet2
Cell Formulas
RangeFormula
I2:J16I2=LET(n,B2:G6,tcn,TOCOL(n),FILTER(HSTACK(TOCOL(IF(n,A2:A6)),tcn),tcn))
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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