How to Merge Cells in Excel Without Losing Data
Jan 14, 2026Quick answer
Excel's Merge & Center keeps only the upper left value. To merge cells without losing data, combine the text first with =TEXTJOIN(", ", TRUE, A1:B1), paste the result as values, then merge or apply Center Across Selection for the look. Combine first, merge second, and nothing is discarded.
Last updated: August 20, 2026
If you have ever clicked the Merge & Center button in Excel, you have likely seen the warning:
"Merging cells only keeps the upper-left value and discards other values."
It is a frustrating moment. You have data in three different cells that you want to bring together, and Excel's default behaviour deletes everything except the first piece of information.
The good news is that you do not have to choose between a clean layout and keeping your data. Whether you are combining first and last names or building a clean header, there are five reliable ways to get the job done.
Table of Contents
- 1. Why does Excel delete your data when you merge cells?
- 2. Which method should you use?
- 3. Method 1: How do you merge cells with TEXTJOIN?
- 4. What if your version of Excel has no TEXTJOIN?
- 5. Method 2: How do you use Flash Fill to merge cells?
- 6. Method 3: How do you merge text vertically with Fill Justify?
- 7. Method 4: How do you merge cells with Power Query?
- 8. Method 5: How do you merge cells with VBA?
- 9. How do you merge rows without losing data?
- 10. How do you merge two columns without losing data?
- 11. How do you get the merged look without merging?
- 12. How do you keep formatting when you merge?
- 13. Why is Merge & Center greyed out?
- 14. What do merged cells break?
- 15. Best practices for keeping your data safe
- 16. Which merge guide do you actually need?
- 17. Frequently asked questions
Get our free Excel formulas cheat sheet
Plus new tutorials and template drops. Enter your email and we'll send it over.
Why does Excel delete your data when you merge cells?
A merge is a formatting operation, not a data operation. Excel is not combining anything. It is drawing one large cell over a block of small ones, and a single cell can hold only one value. Excel keeps the value in the upper left position of the block and discards the rest, because it has nowhere to put them.
That single fact drives every method on this page. If you want to keep the text, you have to put all of it into one cell yourself, before Excel ever draws over the block.

The rule: combine first, merge second. A merge never combines anything, so anything you have not already joined into one cell is gone.
The short version of the safe workflow:
-
Combine the data first using TEXTJOIN, the & operator, Flash Fill, Power Query or VBA
-
Check the result carefully on a few rows
-
Copy, then Paste Values to lock the final text
-
Delete original columns only after confirming the result
-
Use Center Across Selection if you only need a visual merge
-
Keep a backup of the file, especially when using macros
Which method should you use?
| Method | Best for | Updates automatically? | Excel version needed |
|---|---|---|---|
| TEXTJOIN | Most situations. Control over the separator and blank cells | Yes, until you paste values | Excel 2019, Microsoft 365, Excel for the web |
| & operator or CONCATENATE | Older Excel, or joining two or three cells | Yes, until you paste values | Every version |
| Flash Fill | Clean, consistent data where you can show the pattern once | No | Excel 2013 and later, desktop only |
| Fill Justify | Stacking text down one column into a single cell | No | Every desktop version |
| Power Query | Large datasets, or a merge you will repeat every month | Yes, on refresh | Excel 2016 and later on Windows |
| VBA macro | Merging many separate blocks in one pass | No | Desktop Excel, macro enabled file |
| Center Across Selection | When you only want the look and no data joining at all | Not applicable | Every version |
Method 1: How do you merge cells with TEXTJOIN?
This is the safest and most flexible option. You do not merge first. You combine the contents into a new cell, then merge afterwards only for appearance.
Assume this is your table:

Step 1: Add a helper column
Insert a new empty column where you want the combined result.

Step 2: Enter the formula
In the helper cell, for example C1, type:
=TEXTJOIN(", ", TRUE, A1:B1)
What each argument does:
-
", " is the delimiter, a comma followed by a space, placed between every value. Change it to " " for a plain space, " - " for a dash, or "" for no separator at all.
-
TRUE tells Excel to ignore empty cells, so you do not get double separators where a cell is blank. Set it to FALSE if you want blanks to leave a gap.
-
A1:B1 is the range being combined. TEXTJOIN accepts a whole range, which is why it beats CONCATENATE when you have more than a few cells.

To put each value on its own line inside the merged cell, use CHAR(10) as the delimiter and turn on Wrap Text:
=TEXTJOIN(CHAR(10), TRUE, A1:B1)
Step 3: Fill down
Drag the formula down to apply it to the other rows.

Step 4: Lock the result
Right now the result still depends on the original cells. If you delete them, the formula breaks and you lose everything. To make it permanent:
-
Select the helper column
-
Copy
-
Paste, then choose Values only

Step 5: Remove old columns and merge visually
-
Delete the original columns, for example A to C
-
Select the remaining cells
-
Use Merge Cells or Center Across Selection

The rule: never delete a source column while the combined cell is still a formula. Paste values first, then delete.
Microsoft documents the full argument list in its reference for the TEXTJOIN function.
What if your version of Excel has no TEXTJOIN?
TEXTJOIN arrived in Excel 2019 and Microsoft 365. If you are on Excel 2016 or earlier, or your formula returns #NAME?, the function is not available in your build. Two alternatives work in every version of Excel ever shipped.
The ampersand operator
=A1&" "&B1
Read it as "cell A1, then a space, then cell B1". You type the separator yourself between quotation marks. For three cells with a comma between them:
=A1&", "&B1&", "&C1
CONCATENATE
=CONCATENATE(A1," ",B1)
This does the same thing with function syntax. Microsoft has replaced it with CONCAT in newer versions but keeps CONCATENATE working for backward compatibility.
| Formula | Accepts a range? | Skips blanks? | Available in |
|---|---|---|---|
| =TEXTJOIN(", ",TRUE,A1:D1) | Yes | Yes, with TRUE | 2019 and later |
| =CONCAT(A1:D1) | Yes | No separator support | 2019 and later |
| =CONCATENATE(A1," ",B1) | No, one cell per argument | No | Every version |
| =A1&" "&B1 | No | No | Every version |
If you want the deeper walkthrough on joining text, see our guide to the CONCATENATE function.
Method 2: How do you use Flash Fill to merge cells?
Flash Fill is a fast method that needs no formula. You show Excel the pattern once and it fills in the rest. It works well when the data is clean and the pattern is obvious.
Assume this is the data:

Step 1: Create a new column
Insert an empty column next to your data.
Step 2: Type the first result manually
In the first cell of the new column, type the combined result exactly as you want every row to look, for example Sarah Mitchell.

Step 3: Activate Flash Fill
Select the next cell below and press Ctrl + E. Excel fills the rest of the column.

Step 4: Lock the results
Flash Fill creates values, not formulas, so nothing will recalculate. It is still good practice to select the column, copy, and paste as Values only before you delete the source columns.
What else Flash Fill can do
-
Add commas or dashes between values
-
Reorder text, for example last name then first name
-
Combine text and numbers
-
Extract part of a cell before merging, such as an initial
Limitations you should know
-
It is not dynamic. Change a source cell and the result does not update
-
It fails when the pattern varies between rows
-
Large datasets sometimes need re-triggering partway down
-
Inconsistent spacing and typos confuse the pattern detection
-
It is a desktop feature. Ctrl + E does nothing in Excel for the web
The rule: use Flash Fill for a one time cleanup, and a formula for anything that will change again.
Method 3: How do you merge text vertically with Fill Justify?
Fill Justify collapses several cells stacked down one column into a single cell. It only works vertically, which makes it the right tool for turning a column of notes into one paragraph.
Assume the data sits in column A:

Step 1: Select the full range
Select from the first text cell down to the last cell.
Step 2: Widen the column
Widen the column so the top cell is physically wide enough to hold all of the combined text. This step is not optional. Fill Justify redistributes text to fit the column width, so a narrow column will spread the text back over several rows instead of collapsing it into one.

Step 3: Apply Justify
-
Go to Home
-
Click Fill in the Editing group
-
Choose Justify

The result
Excel combines everything into the top cell and clears the cells below it.

Limitations you should know
-
Works vertically only, never across columns
-
Text only. Numbers and dates behave unpredictably and are often left alone
-
No control over the separator. Excel inserts a single space
-
A one time action with no link back to the source
-
It overwrites the cells below without a warning, so undo is your only safety net
Method 4: How do you merge cells with Power Query?
Power Query is Excel's data cleaning and transformation tool. It is the right choice for large datasets and for any merge you will repeat, because the steps are saved and rerun on refresh. Power Query never touches your original data.
Sample data:

Step 1: Convert the data to a table
-
Select your data
-
Press Ctrl + T
-
Click OK

Step 2: Load the data into Power Query
-
Click anywhere inside the table
-
Go to Data, then From Table/Range
-
The Power Query Editor opens

Step 3: Merge the columns
-
Hold Ctrl and select the columns you want to combine. The order you click them is the order they will be joined in
-
Right-click and choose Merge Columns
-
Choose a separator: space, comma, tab, semicolon or a custom string
-
Name the new column
-
Click OK

Step 4: Load the result back to Excel
-
Click Close & Load
-
Excel creates a new sheet with the merged results

The rule: if you will do this merge again next month, do it in Power Query once rather than by formula every time.
New to the tool? Start with our guide to Power Query in Excel.
Method 5: How do you merge cells with VBA?
A macro is worth it when you have many separate blocks to merge and doing them by hand would take an afternoon. This one reads every value in the selection, joins them, merges the block, and writes the combined text back into it.
Press Alt + F11 to open the Visual Basic editor, click Insert, then Module, and paste the code. Select the cells on the sheet, then run the macro with F5 or from the Macros dialog.
Sub MergeKeepingData()
Dim rng As Range
Dim cell As Range
Dim result As String
Set rng = Selection
For Each cell In rng
If Len(cell.Value) > 0 Then
result = result & cell.Value & " "
End If
Next cell
Application.DisplayAlerts = False
rng.Merge
Application.DisplayAlerts = True
rng.Cells(1, 1).Value = Trim(result)
End Sub
Change the " " in the result line to ", " or any other separator you want. Two warnings before you run it: save a copy of the workbook first, because a macro clears the undo history, and save the file as .xlsm or the macro will not survive the next save.
How do you merge rows without losing data?
Merging rows is the same problem turned sideways, and the method depends on what you actually mean.
-
You want several stacked cells in one column joined into one cell. Use Fill Justify, or a formula such as
=TEXTJOIN(" ", TRUE, A1:A5)which reads down a column just as happily as across a row. -
You want to merge two rows side by side, keeping both. Put a formula in a spare cell that reads both rows, for example
=TEXTJOIN(", ", TRUE, A1:D1, A2:D2), then paste values and delete the originals. -
You want to combine duplicate rows into one, joining their values. That is a Power Query job. Load the table, right-click the column that identifies the duplicates, choose Group By, then use the Aggregate option to combine the other column's values.
The rule: TEXTJOIN does not care about direction. A1:A5 works exactly like A1:E1.
How do you merge two columns without losing data?
This is the most common version of the problem: a first name column and a last name column that need to become one.
-
Insert an empty column to the right of the two you want to join.
-
In the first cell of that column, type
=A2&" "&B2or=TEXTJOIN(" ", TRUE, A2:B2). -
Double-click the fill handle at the bottom right of the cell to copy it down the whole column in one action.
-
Select the new column, copy, and paste as Values only.
-
Only now delete the two original columns.
If the two columns hold text that needs a separator other than a space, our step by step guide on combining 2 columns in Excel with a space covers the variations.
How do you get the merged look without merging?
Center Across Selection is the option almost nobody knows about, and it is better than Merge & Center in nearly every case. It centres a heading across several columns visually, but the cells underneath stay separate, so nothing gets deleted and nothing breaks later.
-
Type your heading in the leftmost cell of the range.
-
Select the full range you want the heading centred across.
-
Press Ctrl + 1 to open Format Cells.
-
Go to the Alignment tab.
-
In the Horizontal dropdown, choose Center Across Selection.
-
Click OK.
The result looks identical to a merged heading. Sorting still works, filtering still works, and you can still select a single column underneath it.
The rule: if the merge is purely cosmetic, use Center Across Selection. It looks the same and costs you nothing.
How do you keep formatting when you merge?
When you merge a block, Excel keeps the formatting of the upper left cell and discards the rest, exactly as it does with the values. Bold in the second cell, a different fill colour in the third, a currency format on the fourth: all gone.
Three ways to hold on to it:
-
Use the Format Painter after the merge. Click a cell that has the formatting you want, click Format Painter on the Home tab, then click the merged cell.
-
Format the upper left cell before you merge. Since that is the cell whose formatting survives, set it up correctly first and the merge preserves what you want.
-
Use Center Across Selection instead. Nothing is discarded because nothing is merged, so per cell formatting stays exactly where it is.
One thing a merge cannot preserve at all is mixed formatting inside a single result. If cell A1 is bold and B1 is not, combining them with TEXTJOIN produces one string in one format. To keep part of the text bold you have to apply the formatting by hand to those characters after the values are static, and only in a cell that contains text rather than a formula.
Why is Merge & Center greyed out?
| What you see | Cause | Fix |
|---|---|---|
| Merge & Center is greyed out | Your cells are inside an Excel Table | Click inside the table, go to Table Design, then Convert to Range |
| Merge & Center is greyed out and so is most of the ribbon | The worksheet is protected | Review, then Unprotect Sheet |
| Nothing on the ribbon responds and a yellow bar sits at the top | The file opened in Protected View | Click Enable Editing in the yellow bar |
| You are still in a cell, typing | Excel is in Edit mode | Press Enter or Esc to leave the cell, then try again |
| Merge works but sorting then fails | Merged cells in the range are not identically sized | Select the range, press Alt, H, M, U to unmerge, then sort |
The keyboard sequences are worth memorising: Alt, H, M, C merges and centres, Alt, H, M, A merges across each row separately, Alt, H, M, M merges without centring, and Alt, H, M, U unmerges.
Microsoft's own reference on merging and unmerging cells confirms the upper left rule and the table restriction.
What do merged cells break?
Worth knowing before you merge anything in a working spreadsheet rather than a printed report.
-
Sorting. Excel refuses to sort a range containing merged cells of different sizes and shows "This operation requires the merged cells to be identically sized."
-
Filtering. A filter treats a merged block as belonging only to its first row, so filtering hides rows you expected to keep.
-
Copying and pasting. You cannot paste a normal range over a merged one without Excel rearranging the layout.
-
Keyboard navigation. Ctrl with an arrow key jumps unpredictably around merged blocks.
-
PivotTables. A merged header row will not be accepted as a valid source range.
-
Lookups. VLOOKUP and XLOOKUP read the value from the upper left cell only, so the other rows in a merged block return blanks.
None of this is a reason to never merge. It is a reason to merge only in the presentation layer, at the end, and to keep the working data unmerged. If you also need text to sit neatly inside a merged cell, our guide to wrapping text in Excel covers the merged cell case specifically.
Best practices for keeping your data safe
-
Always combine data first. Use formulas, Flash Fill, Power Query or Justify to get the content into a single cell before merging anything.
-
Use helper columns. They give you control and a safety net, and you can delete them after pasting values.
-
Paste values before deleting source data. This is the most important rule on the page. It locks your results and prevents accidental loss.
-
Use Center Across Selection for appearance. If you only want the merged look, this keeps the cells separate and avoids every merge related problem.
-
Work on a copy of the file. Especially when using Power Query or a macro. One duplicate file saves a lot of stress.
-
Test on a few rows first. Before applying any method to the full dataset, run it on 3 to 5 rows and confirm the result looks right.
Which merge guide do you actually need?
We have three guides in this area and they answer three different questions. Pick the one that matches what you are trying to do.
| If you want to | Read |
|---|---|
| Keep every value when cells are combined (this page) | You are already here |
| Learn the Merge & Center button itself, including Merge Across and unmerging | How to merge cells in Excel |
| Join text from cells into one string with formulas, without changing the layout | How to combine cells in Excel |
| Split combined text back apart | The opposite of CONCATENATE |
| Merge whole worksheets or tables rather than cells | Merge tables in Excel |
| Do any of this in Google Sheets instead | Merge cells in Google Sheets |
Frequently asked questions
Can you merge cells in Excel and keep all the data?
Not with the Merge & Center button alone, because a merge keeps only the upper left value. Combine the values into one cell first with TEXTJOIN or the & operator, paste the result as values, and then merge for appearance.
How do you merge two cells in Excel without losing text?
Type =A1&" "&B1 in an empty cell, copy that cell, and paste it back as Values only. The single cell now holds both pieces of text, and you can delete the originals and merge the layout safely.
What is the difference between merging and combining cells in Excel?
Merging changes the layout by drawing one cell over several and discards all but the upper left value. Combining joins the text from several cells into one value using a formula and changes no layout at all.
Why is Merge and Center greyed out in Excel?
The most common cause is that your cells sit inside an Excel Table, where merging is not allowed. Go to Table Design and choose Convert to Range. A protected sheet and Protected View produce the same symptom.
How do you unmerge cells in Excel?
Select the merged cell and press Alt, H, M, U, or click the Merge & Center button again to toggle it off. The text stays in the upper left cell and the others come back empty.
Does TEXTJOIN work in older versions of Excel?
No. TEXTJOIN needs Excel 2019, Microsoft 365 or Excel for the web. In Excel 2016 and earlier it returns #NAME?, so use =A1&" "&B1 or =CONCATENATE(A1," ",B1) instead.
Final thoughts
Merging cells in Excel is safe as long as you do it in the right order. Most data loss happens when cells are merged too early. Combine the content first, lock it with Paste Values, and only then change how the sheet looks. Whether you use a formula, Flash Fill, Power Query, Justify or a macro, the goal is the same: keep every value intact before you change the layout.
Want to Make Excel Work for You? Try out 5 Amazing Excel Templates & 5 Unique Lessons
We hate SPAM. We will never sell your information, for any reason.
