The post demonstrates how to convert a column into a list of comma separated values.
Let’s see a scenario where we have to insert a condition in some SQL query’s IN operator, the values should be separated by comma and you have a large number of values.
As you could see above we have data in column A and the comma separated list that we require is in column B or in column E.
We will use simple concatenation operator “&” in excel to embed comma to convert column to comma separate list in excel.
Insert the formula =A2&”,” in the cell B2 to insert comma after the value.
Now drag the formula downwards till the data is available to get the list of comma separated values.
Now open a notepad text file and copy the values from excel and paste it into text file as shown below.
You have the comma separated values list to be used anywhere.
The values could directly be pasted into SQL editor if that is what you are looking for.
Hope this helped.