SOLVED

Getting rid of zeros.

%3CLINGO-SUB%20id%3D%22lingo-sub-1493106%22%20slang%3D%22en-US%22%3EGetting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493106%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20I%20have%20a%20column%20of%20numbers%20in%20the%20even%20numbered%20cells%20some%20of%20which%20are%20zero%20and%20the%20odd%20numbered%20cells%20are%20blank.%20For%20instance%20I%20have%20the%20numbers%201%20%2C%202%20%2C%203%20%2C%200%20%2C%204%20%2C%200%20%2C%200%20%2C%205%20%2C%206%20in%20cells%20A2%20%2C%20A4%20%2C%20A6%20%2C%20A8%20%2C%20A10%20%2C%20A12%20%2C%20A14%20%2C%20A16%20and%20A18.%20In%20column%20B%20I%20need%20to%20transpose%20these%20numbers%20without%20the%20zeros%20so%20that%20B2%20%3D%201%20%2C%20B4%20%3D%202%20%2C%20B6%20%3D%203%20%2C%20B8%20%3D%204%20%2C%20B6%20%3D%205%20and%20B8%20%3D%206.%20In%20column%20A%20the%20first%20and%20last%20numbers%20are%20never%20zero.%20Does%20anyone%20have%20a%20simple%20formula%20that%20might%20achieve%20this%3F%20Any%20help%20would%20be%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1493106%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493203%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493203%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F705134%22%20target%3D%22_blank%22%3E%40BLOMCHOP%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20your%20version%20of%20Excel%20supports%20dynamic%20arrays%2C%20when%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIF(%24A%242%3A%24A%2418%3D0%2C%22%22%2C%24A%242%3A%24A%2418)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ein%20B2%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20465px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F201590i74BADFCBEB57D7ED%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Ejust%20adjust%20your%20range.%20Please%20note%2C%20formulas%20in%20Excel%20don't%20return%20blank%20as%20a%20value%2C%20thus%20you%20have%20an%20option%20to%20return%20zero%20or%20empty%20string%20instead.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493204%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493204%22%20slang%3D%22en-US%22%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3EKindly%20attach%20a%20sample%20file%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493252%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493252%22%20slang%3D%22en-US%22%3E%3CP%3EI%20need%20column%20B%20to%20contain%20just%20the%20six%20numbers%20without%20zeros%20or%20blanks.%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493327%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493327%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F705134%22%20target%3D%22_blank%22%3E%40BLOMCHOP%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELike%20this%3F%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20665px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F201627i8A8FC1632D620F2C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIF(ISODD(SEQUENCE(2*COUNT(FILTER(%24A%242%3A%24A%2418%2C%24A%242%3A%24A%2418%26lt%3B%26gt%3B0))))%2C%0A%20%20%20%20%20INDEX(FILTER(%24A%242%3A%24A%2418%2C%24A%242%3A%24A%2418%26lt%3B%26gt%3B0)%2C%0A%20%20%20%20%20%20(SEQUENCE(2*COUNT(FILTER(%24A%242%3A%24A%2418%2C%24A%242%3A%24A%2418%26lt%3B%26gt%3B0)))%2B1)%2F2)%2C%0A%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493340%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493340%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F705134%22%20target%3D%22_blank%22%3E%40BLOMCHOP%3C%2FA%3E%26nbsp%3B%20By%20chance%20are%20your%20numbers%20going%20to%20always%20be%20sequential%20except%20for%20the%200's%20in%20between%20the%20way%20your%20example%20is%3F%26nbsp%3B%20I'm%20guessing%20not%2C%20but%20if%20you%20are%20doing%20some%20sort%20of%20counting%20formula%20in%20that%20column%20it%20is%20possible.%26nbsp%3B%20I%20doubt%20it%20but%20if%20so%2C%20the%20formula%20could%20then%20be%20(starting%20in%20B4)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20IF(AND(B2%3CMAX%3E%22%22)%2CB2%2B1%2C%22%22)%26nbsp%3B%26nbsp%3B%3C%2FMAX%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493392%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493392%22%20slang%3D%22en-US%22%3EThank%20you%20so%20much%20Sergei...%E2%80%A6%E2%80%A6..that%20worked%20perfectly.%20I%20thank%20you%20kindly.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1493729%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20rid%20of%20zeros.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1493729%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F705134%22%20target%3D%22_blank%22%3E%40BLOMCHOP%3C%2FA%3E%26nbsp%3B%2C%20you%20are%20welcome%2C%20glad%20to%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

So I have a column of numbers in the even numbered cells some of which are zero and the odd numbered cells are blank. For instance I have the numbers 1 , 2 , 3 , 0 , 4 , 0 , 0 , 5 , 6 in cells A2 , A4 , A6 , A8 , A10 , A12 , A14 , A16 and A18. In column B I need to transpose these numbers without the zeros so that B2 = 1 , B4 = 2 , B6 = 3 , B8 = 4 , B6 = 5 and B8 = 6. In column A the first and last numbers are never zero. Does anyone have a simple formula that might achieve this? Any help would be appreciated.

7 Replies

@BLOMCHOP 

If your version of Excel supports dynamic arrays, when like

=IF($A$2:$A$18=0,"",$A$2:$A$18)

in B2

image.png

just adjust your range. Please note, formulas in Excel don't return blank as a value, thus you have an option to return zero or empty string instead.

Hello,

Kindly attach a sample file

I need column B to contain just the six numbers without zeros or blanks.@Sergei Baklan 

Best Response confirmed by BLOMCHOP (Occasional Contributor)
Solution

@BLOMCHOP 

Like this?

image.png

=IF(ISODD(SEQUENCE(2*COUNT(FILTER($A$2:$A$18,$A$2:$A$18<>0)))),
     INDEX(FILTER($A$2:$A$18,$A$2:$A$18<>0),
      (SEQUENCE(2*COUNT(FILTER($A$2:$A$18,$A$2:$A$18<>0)))+1)/2),
"")

@BLOMCHOP  By chance are your numbers going to always be sequential except for the 0's in between the way your example is?  I'm guessing not, but if you are doing some sort of counting formula in that column it is possible.  I doubt it but if so, the formula could then be (starting in B4):

 

= IF(AND(B2<MAX(A:A),A4<>""),B2+1,"")  

 

 

 

 

Thank you so much Sergei...……..that worked perfectly. I thank you kindly.

@BLOMCHOP , you are welcome, glad to help