How to merge two rows in excel
Tutor 5 (68 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Merging two rows in Excel is not a direct function like merging columns. Excel allows merging of cells across rows or columns, but merging entire rows requires combining their content into a single row.
Method 1: Using the Merge & Center Tool
-
Select the cells you want to merge across the two rows.
-
For example, to merge cells
A1andA2, select both.
-
-
Go to the Home tab on the Ribbon.
-
Click Merge & Center in the Alignment group.
-
The selected cells combine into one cell. Only the top-left value remains; other values are deleted.
Important: This method will delete data from all cells except the top-left.
Method 2: Concatenating Values Before Merging
-
Choose a blank cell where you want the combined data.
-
Enter the formula to combine the values:
=A1 & " " & A2
-
This merges the content of
A1andA2with a space in between. -
Replace the space
" "with any separator you prefer (e.g., comma", ").
-
-
Copy the result and paste as values if you want to replace the original cells.
-
Select the original cells and use Merge & Center if needed.
Method 3: Using Flash Fill for Large Datasets
-
Insert a new row or column where the merged result will appear.
-
Type the first combined value manually.
-
For example, in
C1, typeJohn DoeifA1 = JohnandA2 = Doe.
-
-
Press Ctrl + E (Windows) or Command + E (Mac).
-
Excel automatically fills the remaining rows with merged data following the pattern.
Method 4: VBA Macro for Merging Entire Rows
For large datasets, a VBA macro can merge rows without losing data:
-
Press Alt + F11 to open the VBA editor.
-
Go to Insert → Module.
-
Paste the following code:
Sub MergeRowsKeepData()
Dim r As Range
Dim cell As Range
Dim combined As String
Set r = Selection
For Each cell In r.Columns(1).Cells
combined = ""
For i = 1 To r.Rows.Count
If r.Cells(i, cell.Column).Value <> "" Then
combined = combined & r.Cells(i, cell.Column).Value & " "
End If
Next i
cell.Value = Trim(combined)
Next cell
r.Merge
End Sub
-
Select the rows to merge and run the macro.
-
The macro combines all values and merges the cells.
Notes and Best Practices
-
Merging cells vertically (across rows) is less common than horizontally.
-
Avoid merging if you plan to sort or filter data; merged cells can cause issues.
-
Use concatenation for preserving data integrity.
-
Always back up data before merging rows to prevent accidental loss.
This approach ensures data from both rows is combined cleanly while allowing you to merge cells for formatting.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to merge excel files into one file
Answers · 1
How to merge excel files into one
Answers · 1
How to mail merge from excel to email
Answers · 1
How to mail merge from excel to pdf
Answers · 1