Excel formula concat text in excel without zero values - excel

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?

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)

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()]")

Looking at your results however, then this:
Something like:
=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

Related

Excel text to rows using formula

I have a concat formula returning me a comma separated list of names in a cell
=concat(A2:A10 & " ,") returning [john, jack, jill] in the cell
Is there a way to add to this formula to expand to
john
jack
jill
in a column like that above?
You can change the separator to be a line break =CONCAT(A2:A10 & CHAR(10)) or =TEXTJOIN(CHAR(10),TRUE,P3:P5)
The target cell needs to be set to Wrap Text for the line breaks to be displayed correctly.
I used Power Editor to convert the cell into rows

TRANSPOSE() function wrongly adding semicolon between cell values

In Excel, I'm combining large lists using TRANSPOSE then CONCATENATE. My lists are >400 names and not always organized by column.
When I hit "F9" Excel has started adding a ";" between all of my values instead of "," thereby breaking the function. Has anyone else seen this? Know how to fix this? If I manually replace the semicolon, it works again.
Example data:enter image description here
If the names are vertical/organized by column
=TRANSPOSE(A1:A12)&", "
The functional output is
={"John, ","Tom, ","Mary, ","Jackson, ","Rob, ","Gerry, ","Heidi, ","Sheila, ","Alison, ","Wendy, ","Laura, ","Marion, "}
If the names are horizontal/organized by row
=TRANSPOSE(A1:L1)&", "
The non-functional output is
={"John, ";"Tom, ";"Mary, ";"Jackson, ";"Rob, ";"Gerry, ";"Heidi, ";"Sheila, ";"Alison, ";"Wendy, ";"Laura, ";"Marion, "}
If the names are vertical (A1:A12). Put
A2 =A1&","
A3 =A2&B3
and drag both until L3. A3 is your result.
If the names are horizontal (A1:L1), put
B1 =A1&", "
C1 =B1&C2
and drag both until C12. C1 is your result.
Hope that solves. (:

SUMIFS (or criteria using cell reference)

I have a SUMIFS formula like this:
=SUM(SUMIFS(DATA!A1: A5000", .. others conditions .., DATA!R1:R5000,"{<=2017/06/05"," "}) this works great, but we need
to replace the date with a cell reference.
Something like this: "{<=E12"," "}.
We can't change SUMIFS since this is not allowed by the client.
Try this, Concat the text with cell using &
=SUM(SUMIFS(DATA!A1:Z5000", ... , DATA!R1:R5000,"{<=" & E12 ," "})
=SUMPRODUCT(SUMIFS(DATA!A1:A5000,DATA!R1:R5000,CHOOSE({1,2},"<="&E12," ")))
Regards

return only values in a row

I have a list of unique ids and values on one sheet in excel as in the image below:
Is there a way to return only the values in the order they appear (left to right) on a separate sheet/location? For example, I would want to return for ID '1002' the values 35,32,44.. not the blanks. I am then going to turn those values into a Sparkline.
I am using excel 2010, if that makes a difference.
Thanks!
Sam
Try this formula:
=SUBSTITUTE(TRIM(B2 & " " & C2 & " " & D2 & " " & E2 & " " & F2)," ",",")
EDIT:
_______________________________________________________________________________
Hope this is not too late to answer your question.
Lets assume your data is in Sheet1 as in the image below:
Now, in Cell B2 of Sheet2 enter the following formula:
=IFERROR(INDEX(Sheet1!$B2:Sheet1!$F2, SMALL(IF(ISBLANK(Sheet1!$B2:Sheet1!$F2), "", COLUMN(Sheet1!$B2:Sheet1!$F2)-MIN(COLUMN(Sheet1!$B2:Sheet1!$F2))+1), COLUMN(A1))),"")
This is an array formula so commit it by pressing Ctrl+Shift+Enter
Drag this formula across till Column F and down till Row 4 or as required. This will give you following result.
I guess this is what you are looking for.
Based on "Concatenating Names with Delimiters" by Allen Wyatt you can use the formula below to achieve the result you wanted.
=MID(IF(B2<>"",","&B2,"")&IF(C2<>"",","& C2,"")&IF(D2<>"",","&D2,"")&IF(E2<>"",","&E2,"")&IF(F2<>"",","&F2,""),2,2000)
Regards,

Basic Excel: How to show an interval in a cell rather than a single number

I want to make a column that lists a +or- 5%variance of a certain calculation.
For example, in column A and B there are a list of numbers and I want column C to show ColumA/ColumnB + or - 5%.
So if A1 = 10 and B1 = 12 then I want C1 to show ".792 to .875" or something like ".792 - .875" or "(.792,.875)".
In order to make it easy to look at, maybe I want a certain format that would change the colors of the 95% # and the 105% number ...
What would one do in these kind of situation?
You can use CONCATENATE, something like this:
=CONCATENATE(ROUND(A1/B1-(A1/B1*0.05),3)," - ",ROUND(A1/B1+(A1/B1*0.05),3))
As far as I know there is no way to have multiple formats in one cell containing a formula. It might be posible with VBA.
To get what your looking for you could use the text function.
You will have to generate the text with a formula, something like
="(" & text(c1,".000") & " - " & text(d1,".000") & ")"
Where c1 and d1 are the ranges you wish to show.
To get it to format with colour you can use conditional formatting on c1 and d1 to colour the cell where your formula is.
SincereApathy's answer doesn't work for me. Based on his answer, but using in-line concatenation instead of the CONCATENATE function:
=ROUND((A1/B1-0,05);3) & " - " & ROUND((A1/B1+0,05);3)

Resources