Home › Guides › Column to Comma Separated List (Excel, Sheets)
You have a column of values (IDs, names, email addresses) and you need them as one line separated by commas: for a database query, a form field, a spreadsheet function or the “To” box of an email. Or you have the opposite problem, a long comma delimited list that needs to become a column. This guide covers every common way to do both, the formulas that work in each spreadsheet, and the quoting problems that quietly break the result.
=TEXTJOIN(", ", TRUE, A2:A100)=TRANSPOSE(SPLIT(A1, ",")); Excel 365 =TEXTSPLIT(A1, , ",")The rest of the guide explains when each one is the right choice and what to watch for.
Going the other way? See how to turn a comma separated list into a column, or how to convert a list to CSV when the file has to be imported somewhere.
If your data is in an email, a document, a web page or a text file, you do not need a spreadsheet at all. Copy the column, paste it into the converter, and the comma separated list appears as you type. In this example the column has five names, one of them repeated. With “Remove duplicates” on, a comma as the separator and single quotes around each item, five rows become one line ready to paste into a query:

Beyond the basic join, the converter can trim stray spaces, drop blank rows, change case, add a prefix or suffix to every item, wrap the whole list in ( ) or [ ], escape quotes that appear inside values, and split a very long list into groups of a fixed size. Each of those exists because of a specific problem covered below.
With your values in A2:A100, this formula joins them with a comma and a space and skips empty cells:
=TEXTJOIN(", ", TRUE, A2:A100)
The first argument is the separator, the second tells Excel to ignore blanks, and the third is the range. TEXTJOIN exists in Excel 2019, Excel 2021 and Microsoft 365. If you have an older version, use one of these instead:
| Situation | What to do |
|---|---|
| Excel 2016 or earlier, a few dozen rows | In column B enter =A2&"," and fill down, copy column B, paste it into a text editor and delete the line breaks |
| Any version, no formulas | Paste the column into Notepad++, open Find and Replace in Extended mode, and replace \r\n with , |
| Large or repeating job | Power Query: load the column, add a Group By, and combine the values with a custom delimiter |
To put quotes around each value, which you need for text in SQL, JSON and most programming languages, do the quoting inside the formula:
=TEXTJOIN(",", TRUE, "'" & A2:A100 & "'")
In Microsoft 365 this just works. In Excel 2019 it must be confirmed as an array formula with Ctrl+Shift+Enter, otherwise it returns only the first item.
TEXTJOIN behaves the same way in Sheets as in Excel:
=TEXTJOIN(", ", TRUE, A2:A100)
Sheets also has JOIN, which does not have an option to ignore blanks. To get the same result with it, filter the blanks out first:
=JOIN(", ", FILTER(A2:A100, A2:A100<>""))
To add quotes, the concatenation has to be evaluated across the range, which in Sheets means wrapping it in ARRAYFORMULA:
=ARRAYFORMULA(TEXTJOIN(",", TRUE, "'" & A2:A100 & "'"))
If the range contains empty cells this will produce empty quoted items (''), so use a range that matches your data or filter blanks as above.
Converting a comma delimited list back to rows (sometimes searched as “comma to column”) is the same job in reverse.
| Tool | Method |
|---|---|
| Google Sheets | =TRANSPOSE(SPLIT(A1, ",")). Note that SPLIT treats each character of the delimiter separately by default, so for ", " add a third argument: SPLIT(A1, ", ", FALSE) |
| Excel 365 | =TEXTSPLIT(A1, , ",") returns the values down a column. Wrap it in TRIM() to remove spaces after the commas |
| Older Excel | Data, then Text to Columns, choose Delimited and Comma. Then copy the row and use Paste Special, then Transpose, to turn it into a column |
| Online | Set the converter’s input separator to Comma and the output separator to New line. Choose “Auto” to split on commas, semicolons, tabs and line breaks together |
People searching for “column to CSV” or “list to CSV” are usually after one of two things, and they are not the same:
Ava,Ben,Cleo,Dev on a single line.The difference matters because real CSV has rules. A field containing a comma, a double quote or a line break must be wrapped in double quotes, and a double quote inside a field is written as two double quotes (this is the convention formalised in RFC 4180). A naive join of the values Smith, John and Lee produces Smith, John,Lee, which a CSV reader sees as three fields instead of two. If your values might contain commas, wrap each item in double quotes and escape any quotes inside them, or use a different separator such as a pipe or a tab.
Wrapping items in quotes is easy until a value contains the quote character. Take the name O’Brien wrapped in single quotes for SQL: 'O'Brien' is invalid, because the apostrophe ends the string early. There are two standard fixes, and which one is right depends on where the list is going:
| Destination | Escape rule | O’Brien becomes |
|---|---|---|
| SQL string literal, CSV | Double the quote character | 'O''Brien' |
| JSON, JavaScript, Python, most code | Put a backslash before the quote (and before any backslash) | 'O\'Brien' |
Does the doubled quote really work? Yes. Inside a quoted SQL string, two single quotes in a row are read as one literal apostrophe, not as the end of one string and the start of another. It is standard SQL and works in PostgreSQL, SQL Server, Oracle, MySQL and SQLite. You can check on your own database with SELECT 'O''Brien';, which returns O'Brien. The backslash form (') works in MySQL by default but not in standard-conforming databases such as PostgreSQL, so doubling the quote is the portable choice for SQL.
The List Converter’s Escape quotes inside items option applies either rule for you. Using the same five names with “O’Brien” added, single quotes, a comma separator and the whole list wrapped in parentheses, the SQL-style output is:
('Ava','O''Brien','Cleo','Dev','Eli','Ben')
A comma separated list inside parentheses is exactly what the IN operator wants:
SELECT *
FROM customers
WHERE name IN ('Ava','O''Brien','Cleo','Dev','Eli','Ben');
Three practical points:
IN list with more than 1,000 expressions (error ORA-01795). SQL Server limits a request to 2,100 parameters. Other databases have no small fixed limit but get slower, and the query text is capped by settings such as MySQL’s max_allowed_packet. If you hit a limit, split the list into groups. The converter’s Split into groups of N items option does this, separating each group with a blank line so you can run them as separate queries or join them with OR name IN.The same technique produces list literals. Wrap each item in double quotes, join with commas, and wrap the whole list in square brackets:
["Ava","Ben","Cleo","Dev"]
That line is valid JSON, valid JavaScript and a valid Python list. JSON requires double quotes, so choose double quotes and the backslash escape option if any value contains a quote or a backslash.
Gmail accepts a comma separated list of addresses in the To, Cc or Bcc field. Outlook traditionally expects semicolons between addresses, although classic Outlook has a setting that also allows commas. If a pasted list is rejected, switch the converter’s separator to Semicolon. Providers also cap the number of recipients per message, so for a big list send in batches. Using Bcc and checking you have the right to email the people on it are your responsibility.
| Symptom | Likely cause | Fix |
|---|---|---|
| Items have a stray space at the start, so lookups fail | Spaces after the commas, or trailing spaces in cells | Turn on trimming, or use TRIM() in the spreadsheet |
| A comma at the end of the list | Built by hand or by a formula that adds a comma after every item | Join with TEXTJOIN or the converter, which only put separators between items |
| Leading zeros disappear (ZIP codes, IDs) | Excel stored the values as numbers | Format the column as Text before pasting the data in |
Empty items such as ,, | Blank rows in the column | Use the “ignore blanks” option (TRUE in TEXTJOIN) or “Remove empty items” |
| Everything is on one row but you expected a column | Values were separated by line breaks inside a single cell | Set the input separator to New line in the converter |
| A name with a comma splits into two | A comma inside a value in a comma separated list | Quote the values, or use a pipe or tab separator |
Paste the column into an online converter such as the List Converter, pick comma as the output separator, and copy the result. It also removes blank rows and duplicates if you want.
Use =TEXTJOIN(", ", TRUE, A2:A100) in Excel 2019 or later and in Microsoft 365. In older versions, build the list with a helper column or use Find and Replace in a text editor.
In Google Sheets use =TRANSPOSE(SPLIT(A1, ",")). In Excel 365 use =TEXTSPLIT(A1, , ","). Online, set the input separator to Comma and the output separator to New line.
Wrap each item while joining, for example =TEXTJOIN(",", TRUE, "'" & A2:A100 & "'"), or tick the quote option in the List Converter. If values can contain the quote character, also enable quote escaping.
It depends on the database. Oracle has historically limited a list to 1,000 expressions, and SQL Server limits a request to 2,100 parameters. Split long lists into groups to stay under the limit.
Not quite. A comma delimited list is a single line of values separated by commas. A CSV file is a text file of rows and fields that follows quoting rules for values containing commas, quotes or line breaks.