To join multiple cell values with a comma, you can use a formula based on the SUBSTITUTE and TRIM functions. You can use this same approach to concatenate values in cells with any delimiter you like. In the example shown, the formula in G5 is:
Working from the inside out, the formula first joins the values the 5 cells to the left using the concatenation operator (&) and a single space between each value:
B5&" "&C5&" "&D5&" "&E5&" "&F5
This part of the formula is annoyingly manual. To speed things up, copy &" "& to the clipboard before you start. Then follow this pattern:
[click] [paste] [click] [paste] [click] [paste]
until you get to the last cell reference. It actually goes pretty past.
The result of this concatenation (before TRIM and SUBSTITUTE run) is a string like this:
"figs apples "
Next, the TRIM function us used to "normalize" all spacing. TRIM automatically strips space at the start and end of a given string, and leaves just one space between all words inside the string. This takes care of extra spaces causes by empty cells.
Finally, SUBSTITUTE is used to replace each space (" ") with a comma and space (", "), returning text like this:
Joining cells with other delimiters
To join cells with another delimiter (separator), just adapt the "new_text" argument inside SUBSTITUTE. For example, to join cells with a forward slash, use:
The TEXTJOIN function is a new function available in Office 365 and Excel 2019. TEXTJOIN allows you to concatenate a range of cells with a delimiter. With TEXTJOIN, the example above would look like this:
The core of this formula is concatenation using the ampersand (&) operator: = "The date is" & date However, if you simply join a date with text and don't control the date format, the date will revert to it's raw serial number format,...
The TEXT function can apply number formatting to numbers just like Excel's built-in cell formats for dates, currency, fractions, and so on. However, unlike Excel's cell formatting, the TEXT function works inside a formula and returns a result that...
The Excel SUBSTITUTE function replaces text in a given string by matching. For example =SUBSTITUTE("952-455-7865","-","") returns "9524557865"; the dash is stripped. SUBSTITUTE is case-sensitive and does not support wildcards.
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.