First, here's a better example of how the criteria test works...first a couple of columns of data:
The formula in D1 that gives us that answer is:
=ConCatIf(A1:A10,C1,B1:B10,", ",TRUE)
First parameter: Range to evaluate
Second param: comparison string. (I chose an a cell with a color in it)
Third param: Range to return values from
Fourth param: The delimiting string for the concatenation, I'm using a comma/space in this example
Fifth param: (optional) TRUE means eliminate duplicated values, FALSE (or omitted) means string all values
I compared the value in C1 to ALL the values in column A, then I string concatenated the values in B that match the rows with the matching criteria in column A.
I think this is clearer with this more common implementation. Once you can use this UDF this way, you can adapt it work in only ONE column.
First, I replace the second range (columnB) with a duplicate set of the first range (columnA). Then, just like I would do to test values in a SUMIF() formula, I change the third parameter (C1) to a value test on a cell I know has nothing in it and use syntax that says "every value that DOESN'T match that cell"...or "greater than or less than this cell".
In a SUMIF(), you do that with "<>"&BB1 (assuming BB1) is empty.
So, now this formula:
=ConCatIf(A1:A10,"<>"&BB1,A1:A10,", ",TRUE)
...reads as "for every cell in A1:A10 that IS NOT blank, string concatenate the values together with a comma/space separating them.
Is that enough?
Bookmarks