How to merge rows in excel without losing data
Tutor 5 (73 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Merging rows in Excel without losing data requires combining the contents of multiple cells into a single cell rather than using the standard Merge & Center option, which deletes all but the top-left cell content.
Method 1: Using the CONCATENATE or CONCAT function
-
Select a blank cell where you want the merged data to appear.
-
Enter the formula using
CONCAT(modern Excel) orCONCATENATE(older Excel):=CONCAT(A1, " ", A2, " ", A3)
-
Replace
A1, A2, A3with the cells you want to merge. -
The
" "adds a space between values; replace with a comma or any separator if needed.
-
Press Enter. The merged text appears in the selected cell.
-
Copy the formula result and paste it as Values to retain the text without the formula.
Method 2: Using the TEXTJOIN function (Excel 2016 and later)
-
Select a blank cell.
-
Enter the formula:
=TEXTJOIN(" ", TRUE, A1:A3)
-
" "is the delimiter between cell contents. -
TRUEignores empty cells. -
A1:A3is the range of cells to merge.
-
Press Enter. The merged data appears in one cell.
-
Copy and paste as Values to make the merged text permanent.
Method 3: Using a simple VBA macro
-
Press Alt + F11 to open the VBA editor.
-
Go to Insert → Module and paste the following code:
Sub MergeRowsKeepData()
Dim rng As Range, cell As Range
Dim mergedText As String
Set rng = Selection
mergedText = ""
For Each cell In rng
If cell.Value <> "" Then
mergedText = mergedText & cell.Value & " "
End If
Next cell
rng.Cells(1, 1).Value = Trim(mergedText)
End Sub
-
Close the editor.
-
Select the rows you want to merge.
-
Press Alt + F8, select
MergeRowsKeepData, and click Run.
This macro combines all selected cells into the top-left cell while keeping all data.
Notes
-
Avoid using the default Merge & Center for merging cells with data. It will keep only the top-left cell content.
-
Using formulas or VBA ensures no data is lost and allows flexible separators like spaces, commas, or line breaks (
CHAR(10)). -
To insert a line break between merged data using
TEXTJOIN, use:=TEXTJOIN(CHAR(10), TRUE, A1:A3)
-
After using
CHAR(10), enable Wrap Text in the cell to display each entry on a new line.
This approach keeps your spreadsheet data intact and readable.
. 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 show duplicates in red
Answers · 1
How to apply duplicate conditional formatting rule
Answers · 1
How to duplicate conditional formatting excel
Answers · 1
What is excel conditional formatting duplicates
Answers · 1