How to text join all negative value references?
Using textjoin function or any other function in Excel. (without VBA code)
You can use formula suggested by JvdV. You can also try TEXTJOIN() with FILTER() formula.
=TEXTJOIN("|",TRUE,FILTER(A2:A7,C2:C7<0))
So, had a quick play and this works:
Only did the first 3 but if() and iferror() or isblank() come to mind if there is only one, two etc results to avoid repeating | without names...
Note, the formula shown in C1 should be SMALL(... not LARGE(...
Related
I have the following formula:
=CONCATENATE(TRANSPOSE(UNIQUE(FILTER(H2:H1048576, H2:H1048576<>"")))&"_","Feedback",TEXT(TODAY()," mm.dd.yy"))
It is producing the following:
I want the call value to be "AAA_BBB_CCC_DDD_Feedback 01.08.21". How do I do this?
Use TEXTJOIN instead of CONCATENATE. Also you don't need FILTER (you can ignore blanks with TEXTJOIN), nor TRANSPOSE.
=TEXTJOIN("_",TRUE,UNIQUE(H2:H1048576))&"_Feedback"&TEXT(TODAY()," mm.dd.yy")
Slightly shorter option (credit to #JvdV):
=TEXTJOIN("_",,UNIQUE(H2:H1048576),TEXT(TODAY(),"F\e\e\d\back mm.dd.yy"))
Similar questions to this have been asked but not exactly like this. There is one that is very close, but that solution is not working for me.
I have a function which returns comma separated values into a cell. I would like to pass the elements in that cell as criteria to a SUMIFS function using an approach like this one.
My attempt is pictured below:
I believe that this is somehow tied to the way that the function is understanding what is in cell G8. It looks like it is adding some extra quotes. If I highlight G8 in the formula bar and press F9, I get:
There are extra quotes on each side of each criteria.
I am open to a custom VBA function solution, but I would prefer something which can be built as a worksheet function. The criteria are returned from a custom VBA function that pulls elements out of a list box and does some regex work to remove extra commas. The number of elements that can be selected is variable so I would like to avoid having to split the criteria into more than one cell. Thanks.
Seems that the raw comma-separated criteria is in G6, All you need is to split this criteria into an array and feed it to SUMIFS. Splitting is available in VBA, but not exposed to Excel. All we need is to write a little UDF that does the splitting of the CSV and use it in our formula:
Function splitCSV(str As String)
splitCSV = Split(str, ",")
End Function
Now the formula in F10 would be:
=SUM(SUMIFS(C3:C10, B3:B10, "blue", A3:A10, splitCSV(G6)))
EDIT
The above is an array formula (Ctrl+Shift+Enter). To have it a normal formula we can use SUMPRODUCT instead of SUM. This leads to more flexibility (normal formula vs array formula) as well as some "expected" performance improvement.
=SUMPRODUCT(SUMIFS(C3:C10, B3:B10, "blue", A3:A10, splitCSV(G6)))
I want to combine a formula that disregards cells where there is a 0 in order to average and also to disregard cells where there is an error such as DIV/0.
I have these two formulas which achieve either of these functions but not both. How would I combine them?
{=AVERAGE(IF(ISNUMBER(M2:P2),M2:P2))}
=AVERAGEIF(M2:P2,"<>0")
You would simply add the criterion of the second to the first:
=AVERAGE(IF(ISNUMBER(M2:P2)*(M2:P2<>0) ,M2:P2))
This is still an array formula and as such needs to be confirmed with Ctrl-Shift-Enter instead of Enter. If done properly then Excel will put {} around the formula.
you could use an if() to check for either condition then use the appropriate average function.
#Scott : better than mine...
I have this Array formula that Works good:
{=SUM(IF(Range1="L";Range*Range))/SUM(IF(Range1="L";Range))}
But if I change SUM(IF to SUMIF doesn't work I don't know why.
{=SUMIF(Range1;"L";Range*Range)/SUMIF(Range1;"L";Range)}
And I want to put SUMIFS, because I want to add a new IF in the first formula, like this:
{=SUMIFS(Range*Range;Range1;"L";Range2;"N")/SUMIFS(Range*Range;Range1;"L";Range2;"N")}
What I can do to put two ifs in the array formula?
SUMIF and SUMIFS are already array formulas (somewhat) and they don't take well to range multiplication. You can use the two criteria in a SUM(IF, or in a SUMPRODUCT, e.g.
=SUM(IF(AND(Range1="L",Range2="N"),Range*Range,0))
=SUMPRODUCT((Range1="L")*(Range2="N")*Range*Range)
Basically, I want to do a SUMIF, but I need to enter an equation for sum_range parameter, so normally, to do a SUMIF, you write:
=SUMIF(CRITERIA_RANGE,CRITERIA,SUM_RANGE)
This is great, but what if I need to do some calculation in my summation? So for example:
=SUMIF(CRITERIA_RANGE,CRITERIA,COL1*COL2)
Is something like this possible?
SUMPRODUCT is commonly used in this case
Eg
=SUMPRODUCT((CRITERIA_RANGE=CRITERIA)*COL1*COL2)
A different answer (NOT FOR POINTS).
Explanation
The reason why you cannot use SUMIF in your scenario is because SUMIF cannot handle Arrays as sumproduct does and hence I would go with Chris's suggestion of using SUMPRODUCT
Alternative
Here is one more way to achieve what you want.
=SUM(IF(CRITERIA_RANGE=CRITERIA,COL1*COL2,""))
ScreenShot
Please note that this is an ARRAY FORMULA which means that instead of pressing ENTER, you have to press CTRL+SHIFT+ENTER