Monday, May 21, 2012

yogi_Query A Range Of Values And Present the Results In A Comma Separated String

Yogi Anand, D.Eng, P.E.       Google Spreadsheet    Post  #549    May 21, 2012     www.energyefficientbuild.com.


user Phattiem said:
query concatenation question
The question is pretty simple. I am running a query to return all columns that contain a matched value. However, instead of returning each hit in a separate column, is there a way to have the output concatenated and separated with a comma?
Example of my query function:
=(query(B2:C5,"select C where B = '" & D2 &"'"))
But this returns 2 columns.
However,
=(concatenate(query(B2:C5,"select C where B = '" & D2 &"'"))) 
Concatenates into the first column (can't figure out how to get a comma separator) but STILL creates and fills a second column.
Any help would be appreciated,
Mark
----------------------------------------------------------------------------------
(by the way in regard to your statement  that your formula
creates and fills a second column
your formula using the QUERY function will output multiple rows, but only one column)

following is my proposed solution using the JOIN function

No comments:

Post a Comment