I’m using MCONCAT (part of the morefunc Excel add-in package) to pull extract unique matches from a list of data, my code is as follows:
=MCONCAT(UNIQUEVALUES(OFFSET(B$1,MATCH(D2,A$2:A$68761,0),,COUNTIF(A$2:A$68761,D2))),", ")
This all works OK providing that there is more than one result, otherwise it doesn’t seem to work. It DOES work without using UNIQUEVALUES but that returns an enormous amount of results for some lines.
=MCONCAT(OFFSET(B$1,MATCH(D8,A$2:A$68761,0),,COUNTIF(A$2:A$68761,D8)),", ")
Does anyone know how to make my first query work for rows with only a single match?
Many Thanks,
Joe
What’s happening here is that UNIQUEVALUES function needs to be passed an “array” and in most cases OFFSET does that…..except when the COUNTIF = 1 and the OFFSET is then just a single value (not an array containing one value) and UNIQUEVALUES doesn’t like that so returns an error. I don’t know a particularly elegant way round that, perhaps just build a VLOOKUP into the formula when there’s an error, i.e.
=IFERROR(MCONCAT(UNIQUEVALUES(OFFSET(B$1,MATCH(D2,A$2:A$68761,0),,COUNTIF(A$2:A$68761,D2))),", "),VLOOKUP(D2,A$2:B$68761,2,0))