Reputation: 23
I am new to excel formulas. How to skip the zeros and the show result in image format with the yellow colour columns in the excel formula?
Upvotes: 0
Views: 367
Reputation: 11
In one single Cell:
Cell E2 =TEXTJOIN(" ";TRUE;IF(A2:D2=0;"";A2:D2))
Or if you are looking from min max only:
cell E2 = MIN(a2:d2)&" "&MAX(a2:d2)
Upvotes: 0
Reputation: 36880
As per your sample data it seems simple below formula should work.
=A2&" "&MAX(B2:D2)
Or can try-
=A2 & " " & XLOOKUP(1000,B2:D2,B2:D2,,-1,-1)
and if you want actually non zero right cell data (including text data) then use FILTERXML()
like-
=A2& " " & FILTERXML("<t><s>"&TEXTJOIN("</s><s>",TRUE,FILTER(B2:D2,B2:D2>0))&"</s></t>","//s[last()]")
Upvotes: 1
Reputation: 34055
If the results are not always in ascending order (if they are @Solar Mike has already solved it for you with MAX) then perhaps:
=A2&" "&LOOKUP(2,1/(B2:D2<>0),B2:D2)
Upvotes: 1
Reputation: 8375
Looking at your results however, then this:
=if(A2>0,A2&" ","")&if(B2>0,B2&" ","")&if(C2>0,C2&" ","")&if(D2>0,D2&" ","")
will work. Probably could be made shorter... And should work with all versions of Excel.
Ba
Upvotes: 0