Skip to footer content
EXCEL TOOLS

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide

Written by the team at Iron Software. If you are looking to automate your spreadsheet tasks programmatically, be sure to visit the IronXL product page to learn more about our professional Excel library for .NET.

In the world of data management, information is rarely delivered in the exact format you need. Perhaps you have a list of first names in one column and last names in another, or maybe you're trying to build a full mailing address from separate street and city fields. Manually retyping this data is not only a drain on your productivity but also an invitation for human error.

Learning how to combine two columns in Excel is a fundamental skill that transforms raw data into usable information. Whether you are preparing a marketing email list, reconciling financial reports, or organizing a database, Excel offers several powerful tools to merge data seamlessly.

The quickest way to combine two columns is by using Flash Fill (Ctrl + E) or a simple Ampersand (&) formula. For a basic name merge, simply type the desired result in the first cell (e.g., "John Smith"), move to the next cell, and press Ctrl + E. Excel will instantly recognize the pattern and fill the rest of the column for you. If you prefer a formula-based approach that updates automatically, the sequence $=A2& " " & B2$ will join the contents of two cells with a space in between.

Method 1: The Quickest Way (Flash Fill)

If you aren't a fan of formula dependency and want the job done in seconds, Flash Fill is your best friend. Introduced in Excel 2013, this feature uses "predictive intelligence" to sense what you are trying to achieve and finishes the work for you.

How to Use Flash Fill to "Merge Cells" from Columns in Excel

  1. Create a target column: Ensure you have an empty column next to the data you want to combine.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 1 - Empty column next to data

  1. Type the first entry: In the first empty cell (e.g., C2), type exactly how you want the combined data to look using the data from columns A and B.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 2 - Typed first entry for how my data should combine

  1. Provide a second example (Optional): If Excel doesn't catch on immediately, type the desired result in the second cell (C3).

    1. Trigger the Magic: Press Ctrl + E on your keyboard. Alternatively, go to the Data tab on the ribbon and click the Flash Fill button.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 3 - Example output for how to combine two columns in Excel with flash fill

Professional Tip: Flash Fill is "static." If you change the name in Column A later, the combined result in Column C will not update automatically. For dynamic data, use the formula methods listed below.

Method 2: The Ampersand Operator (&)

The Ampersand (&) is the standard operator for "concatenation" (the fancy word for joining things together). It is highly reliable and works in every version of Excel ever made.

The Basic Logic

The formula structure follows a simple pattern:

=Cell1 &"Separator" & Cell2
=Cell1 &"Separator" & Cell2
`=Cell1 & "Separator" & Cell2`
$vbLabelText   $csharpLabel

Steps to Implement

  1. Select the cell where you want the combined data to appear.
  2. Enter the formula. For example, to join a First Name (A2) and Last Name (B2) with a space:
=A2&" "& B2
=A2&" "& B2
$vbLabelText   $csharpLabel

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 4 - Adding the formula

  1. Press Enter.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 5 - Auto filled cell with combined data

  1. Double-click the Fill Handle (the small green square at the bottom-right of the cell) to copy the formula down the entire column.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 6 - Combined data successful in entire column

Method 3: Using the CONCATENATE and CONCAT Functions

While the ampersand is quick, Excel provides built-in functions designed specifically for merging data.

CONCAT vs. CONCATENATE

  • CONCATENATE: The legacy function. It requires you to select every cell individually.
  • CONCAT: The modern replacement. It allows you to select entire ranges (e.g., $A2:D2$) to merge them all at once.

Steps to Implement CONCAT

  1. Click on your target cell.
  2. Type the following formula to combine cells with a comma separator:
=CONCAT(A2,",",B2)
=CONCAT(A2,",",B2)
=CONCATENATE(A2, ",", B2)
$vbLabelText   $csharpLabel

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 7 - Using CONCAT function to combine two columns

  1. If you have a long list of cells to merge without separators, you can simply use:
=CONCAT(A2:Z2)
=CONCAT(A2:Z2)
The provided code appears to be an Excel formula rather than C# code. If you intended to provide C# code for conversion to VB.NET, please provide the correct C# code snippet.
$vbLabelText   $csharpLabel

This will merge multiple cells with ease, as seen here:

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 8 - Merged columns with CONCAT function

Method 4: The Power User’s Choice (TEXTJOIN)

If you are using Excel 2019 or Microsoft 365, TEXTJOIN is the most efficient method. It solves the two biggest headaches of merging columns: dealing with blank cells and repetitive delimiters (like commas or spaces).

Why TEXTJOIN is Superior

With standard concatenation, if a middle name is missing, you often end up with two spaces in the middle of your result. TEXTJOIN allows you to "ignore blank cells."

Steps to Implement

  1. Select your target cell.

    1. Enter the formula:
    =TEXTJOIN(" ",TRUE,A2,B2)
    =TEXTJOIN(" ",TRUE,A2,B2)
    `=TEXTJOIN(" ", TRUE, A2, B2)` is a formula used in Excel, not C# code. If you intended to convert a C# code snippet that involves string joining, please provide the correct C# code. If this is indeed what you want to convert, please clarify how you would like it to be represented in VB.NET or any other context.
    $vbLabelText   $csharpLabel
    • " ": This is the delimiter (the space between words).

    • TRUE: This tells Excel to ignore any empty cells in the range.

    • A2, B2: These are the cells you are merging.

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 9 - Example use of TEXTJOIN

This will result in your two columns of data being combined into a single column like this:

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 10 - Example output using TEXTJOIN

Method 5: Using Power Query for Massive Datasets

When you are dealing with hundreds of thousands of rows, formulas can slow down your workbook. Power Query is a professional-grade tool built into Excel that handles data transformation outside of the standard grid.

Steps to Merge Columns in Power Query

  1. Select your data range and go to Data > From Table/Range.
  2. In the Power Query Editor window, hold Ctrl and click the headers of the columns you want to combine.

  3. Right-click on one of the selected headers and choose Merge Columns.
  4. Choose your Separator (Space, Tab, Comma, etc.) and give the new column a name.

  5. Click OK, then click Close & Load to return the merged data to Excel.

Method 6: Merging with a VBA Macro

For those who perform the same cleanup tasks daily, a small VBA script can automate the merging process across multiple workbooks.

  1. Press Alt + F11 to open the VBA Editor.

  2. Go to Insert > Module.
  3. Paste the following code:
Sub MergeColumns()
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 2 To lastRow
        Cells(i, 3).Value = Cells(i, 1).Value & " " & Cells(i, 2).Value
    Next i
End Sub
Sub MergeColumns()
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 2 To lastRow
        Cells(i, 3).Value = Cells(i, 1).Value & " " & Cells(i, 2).Value
    Next i
End Sub
Sub MergeColumns()
    Dim lastRow As Long
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i As Integer = 2 To lastRow
        Cells(i, 3).Value = Cells(i, 1).Value & " " & Cells(i, 2).Value
    Next i
End Sub
$vbLabelText   $csharpLabel
  1. This macro will take values from Columns A and B and place the combined string in Column C.

Common Issues and Troubleshooting

Merging data often reveals hidden inconsistencies in your spreadsheet. Here is how to fix the most common problems.

1. Merging Dates and Currency

If you try to combine a name with a date using =A2 & B2, the date will appear as a five-digit number (e.g., 45120). This is because Excel stores dates as serial numbers.

  • Solution: Use the TEXT function to keep the formatting:

    =A2& " " & TEXT(B2,"mm/dd/yyyy")
    =A2& " " & TEXT(B2,"mm/dd/yyyy")
    =A2 & " " & TEXT(B2, "mm/dd/yyyy")
    $vbLabelText   $csharpLabel

2. Excessive Spaces

If your source data has accidental leading or trailing spaces, your merged results will look messy.

  • Solution: Wrap your cell references in the TRIM function:

    =TRIM(A2) &"  "& TRIM(B2)
    =TRIM(A2) &"  "& TRIM(B2)
    `=TRIM(A2) & "  " & TRIM(B2)`
    $vbLabelText   $csharpLabel

3. Numbers Turning into Text

Once you merge two columns, the result is always a String (text). You cannot perform mathematical sums on a cell that contains "Item 100".

  • Solution: If you are merging two numbers to create a new ID, and you need it to stay a number, wrap the whole formula in VALUE():

    =VALUE(A2 & B2)
    =VALUE(A2 & B2)
    `=VALUE(A2 & B2)` is an Excel formula, not C# code. If you intended to convert a C# expression involving string concatenation and conversion to a number, please provide the C# code. If this is indeed an Excel formula, it doesn't require conversion to VB.NET.
    $vbLabelText   $csharpLabel

For Developers: Automating Column Merging with IronXL

While Excel’s interface is great for manual tasks, software engineers often need to merge columns programmatically. This is common when building automated reporting tools or migrating data from a database into a user-friendly spreadsheet.

IronXL allows .NET developers to perform these operations without having Microsoft Office installed on the server. It provides a clean, intuitive API to read, merge, and format cells at scale.

Why Use IronXL?

  • Speed: Process massive workbooks faster than the Excel GUI or Interop.
  • No Dependencies: Works on Linux, Azure, and Windows without requiring Excel to be installed.
  • Accuracy: Eliminate the risk of a user accidentally breaking a formula in a shared workbook.

Code Snippet: Merging Columns in C#

The following example shows how to load a spreadsheet and programmatically combine two columns into a third using IronXL.

using IronXL;
// Load the existing workbook
WorkBook workbook = WorkBook.Load("Customer_Data.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;
// Iterate through the rows to combine Column A (First Name) and B (Last Name)
for (int i = 1; i <= sheet.RowCount; i++)
{
    string firstName = sheet["A" + i].StringValue;
    string lastName = sheet["B" + i].StringValue;
    // Set the value of Column C to the combined string
    sheet["C" + i].Value = $"{firstName} {lastName}";
}
// Save the updated file
workbook.SaveAs("Consolidated_Customer_Data.xlsx");
using IronXL;
// Load the existing workbook
WorkBook workbook = WorkBook.Load("Customer_Data.xlsx");
WorkSheet sheet = workbook.DefaultWorkSheet;
// Iterate through the rows to combine Column A (First Name) and B (Last Name)
for (int i = 1; i <= sheet.RowCount; i++)
{
    string firstName = sheet["A" + i].StringValue;
    string lastName = sheet["B" + i].StringValue;
    // Set the value of Column C to the combined string
    sheet["C" + i].Value = $"{firstName} {lastName}";
}
// Save the updated file
workbook.SaveAs("Consolidated_Customer_Data.xlsx");
Imports IronXL

' Load the existing workbook
Dim workbook As WorkBook = WorkBook.Load("Customer_Data.xlsx")
Dim sheet As WorkSheet = workbook.DefaultWorkSheet

' Iterate through the rows to combine Column A (First Name) and B (Last Name)
For i As Integer = 1 To sheet.RowCount
    Dim firstName As String = sheet("A" & i).StringValue
    Dim lastName As String = sheet("B" & i).StringValue
    ' Set the value of Column C to the combined string
    sheet("C" & i).Value = $"{firstName} {lastName}"
Next

' Save the updated file
workbook.SaveAs("Consolidated_Customer_Data.xlsx")
$vbLabelText   $csharpLabel

IronXL Example Output with Combined First and Last Names

How to Combine Two Columns in Excel: A Complete Step-by-Step Guide: Image 11 - Example output with IronXL

Comparison of Methods

| Method | Best For | Speed | Dynamic? | | --- | --- | --- | --- | | Flash Fill | One-off, visual tasks | Instant | No | | Ampersand (&) | Simple 2-column merges | Very Fast | Yes | | TEXTJOIN | Multiple columns/empty cells | Fast | Yes | | Power Query | Massive datasets (100k+ rows) | Moderate | Yes (on refresh) | | IronXL (.NET) | Automated apps & servers | Instant | Programmable |

Summary and Best Practices

Mastering the ability to combine columns is about choosing the right tool for the specific job.

  1. Use Flash Fill for quick, one-time fixes where you don't want to think about formulas.

  2. Use TEXTJOIN for professional reports where data might be missing in some rows.

  3. Always use TRIM if your data comes from an external database to avoid awkward spacing.

  4. Audit your data after merging, especially when dealing with dates or currency, to ensure formatting remains intact.

Ready to take your data automation further? Whether you're a business analyst or a developer, Iron Software provides the tools to make your workflow more efficient. Try IronXL for your next project and see how easy spreadsheet management can be.

Try IronXL’s free trial today!

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he ...
Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me