How to Concatenate Multiple Columns in Google Sheets

Published on

Concatenating columns in Google Sheets can sometimes save a lot of time. For example, you may have first and last names in separate columns. Instead of manually combining them, you can use a formula to merge them into a single column.

In other cases, concatenation can simplify data entry. For example, if you have product codes as sequences in one column and product text IDs in another, you can generate a sequence using the SEQUENCE function in one column and enter product text IDs in another column before combining them.

To concatenate multiple columns in a row, you can use functions such as CONCATENATE, JOIN, TEXTJOIN, and the & (Ampersand) operator. When working with multiple-column ranges, you should use ARRAYFORMULA or the BYROW/MAP lambda functions.

Concatenate Multiple Columns in a Row

Consider the following dataset:

First NameLast NameCityCountryPhone Number
AshishPatelMumbaiIndia123-456-7890

The range A2:E2 represents the data without headers. Let’s concatenate these columns in F2.

Using Ampersand

=A2&" "&B2&", "&C2&", "&D2&", "&E2
Concatenating columns in a row using the ampersand (&) operator in Google Sheets

This formula:

  • Adds a space between the first and last name.
  • Separates address components with a comma followed by a space.

Note:

  • You must specify each cell and delimiter individually.
  • It allows flexibility in choosing delimiters.
  • It removes number or date formatting. Use TEXT to retain formatting.

Example: If B2 contains a date, use:

TEXT(B2, "DD/MM/YYYY")

If B2 contains currency, use:

TEXT(B2, "$##.00")

Using CONCATENATE

This function works similarly to the Ampersand approach:

=CONCATENATE(A2, " ", B2, ", ", C2, ", ", D2, ", ", E2)

Key Points:

  • Requires specifying each cell and delimiter manually.
  • Allows flexibility in choosing delimiters.
  • Removes number and date formatting (use TEXT to preserve them).

Using JOIN

=JOIN(" ", A2:E2)

Advantages:

  • Allows specifying a delimiter while concatenating a range.
  • Retains number and date formatting.

Limitations:

  • Cannot use different delimiters between columns.

This formula produces:

Joining columns in a row using the JOIN function in Google Sheets

Using TEXTJOIN

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

Benefits:

  • Works like JOIN, but allows excluding empty cells.
  • The TRUE argument ensures empty cells are skipped.
  • Retains number and date formatting.

If you want to include empty cells, change TRUE to FALSE.

Concatenate Multiple Columns in Each Row

Now, let’s concatenate multiple columns for multiple rows. Suppose you have addresses of several people in the range A2:E. You can apply formulas to all rows instead of dragging down manually.

Using Ampersand with ARRAYFORMULA

=ArrayFormula(IF(A2:A="",,A2:A&" "&B2:B&", "&C2:C&", "&D2:D&", "&E2:E))
  • Expands the formula to multiple rows.
  • Returns a blank if the first column (A2:A) is empty.
Concatenating multiple columns per row using the ampersand (&) operator in Google Sheets

Using CONCATENATE with MAP

Using CONCATENATE for multiple rows requires MAP:

=MAP(
   A2:A, B2:B, C2:C, D2:D, E2:E, 
   LAMBDA(col_1, col_2, col_3, col_4, col_5, IF(col_1="",, 
      CONCATENATE(col_1, " ", col_2, ", ", col_3, ", ", col_4, ", ", col_5)
   ))
)

Here’s how it works:

  • MAP processes each row individually.
  • LAMBDA assigns variable names (col_1, col_2, etc.) for use inside CONCATENATE.

Using JOIN with BYROW

=BYROW(A2:E, LAMBDA(row, IF(COUNTA(row)=0, "", JOIN(" ", row))))
  • BYROW applies JOIN row-wise.
  • This method is useful when concatenating a large number of columns.
Joining multiple columns in each row using BYROW with the JOIN function in Google Sheets

Using TEXTJOIN with BYROW

=BYROW(A2:E, LAMBDA(row, TEXTJOIN(" ", TRUE, row)))
  • More efficient than JOIN.
  • Can exclude empty cells automatically.

Handling Large Datasets

Concatenation may break if applied to several hundred rows. Functions like MAP and BYROW use lambda functions, which can slow down performance.

For large datasets, consider using QUERY as an alternative:

=TRANSPOSE(QUERY(TRANSPOSE(A2:E),,9^9))
  • This approach efficiently concatenates all columns in each row.
  • It does not allow custom delimiters (defaults to a space).

Summary

To concatenate columns in Google Sheets efficiently:

  • Use & or CONCATENATE for flexibility.
  • Use JOIN or TEXTJOIN for simplicity.
  • Use ARRAYFORMULA or BYROW for multi-row concatenation.
  • Use QUERY for large datasets.

Additional Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

Rank per Group in Excel

You have two groups of 20 students each. How do you determine the rank...

Real-Time Excel Filtering Using Combo Box & FILTER Function

In this tutorial, you’ll learn how to set up real-time Excel filtering using a...

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

More like this

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

How to Extract Top N from Aggregated Query Results in Google Sheets

To summarize data in Google Sheets, you can use the QUERY function. However, if...

How to Use RANK IF in Google Sheets (Conditional Ranking)

You can use the RANK function to rank values in an entire dataset. But...

4 COMMENTS

  1. So I’m not trying to extract the string from another line in the same cell I am trying to make a list separated by a line break from strings in separate cells

    Right now I am doing the following:

    =Sheet 1!E:E&" "&Sheet 2!E:E&" "&Sheet 3!E:E

    Which will give me whatever is entered into the E column of that cell in each sheet into a single cell separated by spaces. Eg: if I enter A in Sheet 1 B in Sheet 2 and C in Sheet 3 it will output A B C in the target cell.

    Is there a way to insert a linebreak where I currently have my spaces so that the list would read

    A
    B
    C

    Within the same cell

    As opposed to
    A B C ?

    Thanks!

    • Hi, Adam,

      Thanks for the clarification.

      The character that represents the new line can be generated using the CHAR function as below.

      =CHAR(10)

      You can use this formula instead of ” ” in your formula as below.

      ="Info"&char(10)&"inspired"

      So your formula will be like;

      =ArrayFormula('Sheet 1'!E:E&char(10)&'Sheet 2'!E:E&char(10)&'Sheet 3'!E:E)

      Hope this helps.

  2. I’m trying to find a way to concatenate a string from a cell with a string from another cell that starts on the next line within the same cell. Is there a way to move to the next line within a formula?

    • Hi, Adam,

      To extract the string after the first line in the same cell, you can use the below formula.

      =mid(D4,find(char(10),D4)+1,len(D4))

      Please replace D4 with the cell that contains your string.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.