Spreadsheet Practice

How to combine cells with a comma and skip blanks in Excel

Formula (Excel and Google Sheets)

=TEXTJOIN(", ",TRUE,A2:E2)

Use TEXTJOIN with TRUE as the second argument: =TEXTJOIN(", ",TRUE,A2:E2) puts ", " between the values and skips empty cells.

Result on the example
one result per row in F2, filled down to F6
Works in
Excel 2019 and later, including Microsoft 365
Google Sheets
Same formula

See it work

The formula is already in F2, filled down to F6. Change any input and the result updates, or edit the formula to experiment.

How it works

TEXTJOIN takes the separator first, then whether to ignore empty cells, then the cells. With TRUE, a blank unit is left out entirely, so you never get ", ," in the middle of an address.

=TEXTJOIN(", ",TRUE,A2:E2)

Result"1420 Lake St, Apt 3, Minneapolis, MN, 55401"

  1. A2:E21 row × 5 cols: "1420 Lake St", "Apt 3", "Minneapolis", "MN", …

    A range: 5 cells in one row.

  2. TEXTJOIN(", ",TRUE,A2:E2)"1420 Lake St, Apt 3, Minneapolis, MN, 55401"

    TEXTJOIN: Joins text with a delimiter between items.

    • delimiter", "
    • ignore_emptyTRUE
    • text1A2:E21 row × 5 cols: "1420 Lake St", "Apt 3", "Minneapolis", "MN", …

In Google Sheets

The same formula works in Google Sheets: =TEXTJOIN(", ",TRUE,A2:E2). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=A2&IF(B2="","",", "&B2)&", "&C2&", "&D2&", "&E21420 Lake St, Apt 3, Minneapolis, MN, 55401, 88 Oak Ave, Saint Paul, MN, 55102, 7 Elm Ct, Suite 200, Madison, WI, 53703…Works in Excel 2016 and earlier: add the optional part, with its comma, only when it isn't blank.
=A2&", "&B2&", "&C2&", "&D2&", "&E21420 Lake St, Apt 3, Minneapolis, MN, 55401, 88 Oak Ave, , Saint Paul, MN, 55102, 7 Elm Ct, Suite 200, Madison, WI, 53703…Different resultPlain joining with &. Blank units leave a double comma: "88 Oak Ave, , Saint Paul…".

Common mistakes

  • A cell with only a space isn't empty, so TEXTJOIN keeps it and you get ", ,". TRIM the source data.
  • TEXTJOIN needs Excel 2019 or later. In older versions use the IF version.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Combine cells with a comma and skip blanks

In F2, join the address parts in A2:E2 with a comma and a space, skipping empty cells, and fill down to F6.

Questions

How do I use different separators, like "City, ST 55401"?

Join the parts yourself: =TEXTJOIN(", ",TRUE,A2:C2)&", "&D2&" "&E2.

Does TEXTJOIN work in Google Sheets?

Yes, with the same arguments.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.