← Excel Course contents
📗 Excel · Basics 5Published · 8 min read

How to merge cells in Excel — Merge & Center, the sort error, a filter that shows one row, and centering without merging

If you merged cells to center a title or to show a group as one cell, and then sorting stopped working or a filter showed only one row, this lesson is for you. Using a made-up score sheet (Class, Name, Score — six students), it shows what Merge & Center does to your values, why a merged table can't be sorted or filtered properly, how to unmerge and fill every blank in one go, and how Center Across Selection centers a title without merging. Every result was measured in Excel for Microsoft 365 on this PC.

Merge & Center — only the upper-left value survives

Drag over the cells to combine and click Home > Alignment group > Merge & Center. They become one cell with the text centered. If two or more of the selected cells hold values, a warning comes first.

Home|Merge & Center
A1fx1st term scores
ABC
11st term scoresTerm 12026
1/4A1, B1 and C1 hold '1st term scores', 'Term 1' and '2026'. Select all three and click Home > Merge & Center
Try it — merging three cells that each hold a value (the steps play on their own)
A1, B1, C1Values (measured on this PC)
Before1st term scores · Term 1 · 2026
Merge & Center → OK1st term scores · (empty) · (empty)
Unmerge Cells1st term scores · (empty) · (empty) — not restored

The ▾ next to Merge & Center offers Merge & Center, Merge Across, Merge Cells and Unmerge Cells. Merge Across merges each row of the selection separately — merging E1:G2 across gave two cells, E1:G1 and E2:G2, each keeping its own left value (e1, e2). Merge Cells merges without centering; Unmerge Cells splits a merged cell again.

⚠️

Discarded values don't come back when you unmerge. If you need every value in the merged cell, join them first with a formula such as =A1&" "&B1.

Trap 1 — a table with merged class cells won't sort

The practice file is a score sheet with Class (column A) merged three rows at a time and the title merged across A1:C1. It looks tidy, but sorting and filtering break.

Data|Sort Largest to Smallest
C4fx95
ABC
11st term scores
2ClassNameScore
3Class 1Kim82
4Lee95
5Park77
6Class 2Choi88
7Jung91
8Kang70
1/7Class (column A) is merged three rows at a time — click a score cell and choose Data > Sort Largest to Smallest
Try it — sort error and one-row filter → unmerge and fill → Center Across Selection

With a score cell (C4) selected, Home > Sort & Filter > Sort Largest to Smallest brought up the error 'To do this, all the merged cells need to be the same size.' After OK the table hadn't changed at all. The sort range mixes three-row merged cells (column A) with single cells (columns B and C).

ℹ️

Microsoft's troubleshooting article on this error says every merged cell in a sort range must span the same number of rows and columns. Unmerge them all, or make them the same size.

Trap 2 — the filter shows one row out of three

On the same sheet, filtering the Class column to Class 1 showed only Kim — one of the three Class 1 students. The status bar said '1 of 6 records found'.

A merged cell's value is stored in its first cell only (A3); A4 and A5 are empty. Unmerge it and you can see it — A3 kept 'Class 1' and A4 and A5 were blank (A6 to A8 likewise). So the filter keeps only the A3 row.

Watch as a short — this section in under a minute (CODINGNOW EN)www.youtube.com/shorts/X5Kg04fhPEM

The fix — unmerge, then fill the blanks with the value above

  1. 1Select A3:A8 and choose Home > Merge & Center ▾ > Unmerge Cells. Only A3 and A6 keep a class; four cells are blank.
  2. 2With A3:A8 still selected, Home > Find & Select > Go To Special… > Blanks > OK. Only the four blanks (A4:A5, A7:A8) are selected.
  3. 3Type = and press ↑ (the cell above) and then Ctrl+Enter. Every selected blank gets 'the cell above' at once.
  4. 4Copy A3:A8 and Paste Values so the formulas become text (Class 1, Class 2) and sorting can't shift them.

After that, filtering to Class 1 showed all three students (3 of 6), and sorting by score worked without an error: 95, 91, 88, 82, 77, 70. That is the answer file.

Center without merging — Center Across Selection

If you only want a title centered over a table, use this instead of merging. Select A1:C1 and press Ctrl+1 (Format Cells) > Alignment > Horizontal: Center Across Selection > OK.

On this PC the title then looked centered over three columns but was not a merged cell (A1 not merged, B1 still empty), and sorting the same range raised no error. For a value repeated over several rows, like the class, keep it in every row instead of merging — that's what kept sorting and filtering working.

Common problems

  • Text disappeared after merging: only the upper-left value is kept — join values first with =A1&" "&B1
  • 'All the merged cells need to be the same size' when sorting: merged cells of different sizes in the range — unmerge and fill the blanks
  • The filter shows only one row: the merged value is in the first cell only — unmerge and fill the blanks
  • Can't find unmerge: the ▾ next to Merge & Center > Unmerge Cells
  • Just want a centered title: Format Cells > Alignment > Center Across Selection

Practice

Open the practice file (score sheet with the title and classes merged) and try these steps.

  1. 1Select a score cell and sort largest to smallest — does the error appear?
  2. 2Turn on a filter and show Class 1 only — how many rows do you see? (One on this PC.)
  3. 3Clear the filter, unmerge A3:A8, Go To Special > Blanks, =A3 (the cell above), Ctrl+Enter, then Paste Values.
  4. 4Sort and filter again, then unmerge the title A1:C1 and use Center Across Selection.

The answer file has a class in every row, sorted by score from largest to smallest with the filter on, and a title centered with Center Across Selection.

FAQ

Q. Does merging cells in Excel delete data?

If two or more cells hold values, only the upper-left value is kept. On this PC Excel warned 'Merging cells only keeps the upper-left value and discards other values.'; after OK, B1 and C1 were cleared and unmerging didn't bring them back.

Q. Why do I get 'To do this, all the merged cells need to be the same size' when sorting?

The sort range mixes merged cells of different sizes (for example a three-row class cell next to single name cells). Unmerge, then Go To Special > Blanks > =cell above > Ctrl+Enter to fill the blanks, and the sort works.

Q. Why does filtering merged cells show only one row?

A merged value is stored in the first cell only, so the other rows look empty to the filter. On this PC a Class 1 filter showed one of three students (1 of 6); after unmerging and filling the blanks, all three showed.

Q. How do I center a title without merging cells?

Select the cells under the title and press Ctrl+1 > Alignment > Horizontal: Center Across Selection. It looks centered, but the cells stay separate, so sorting and copying keep working.

Comments 0

No comments yet. Be the first.

Only members can comment.

Comments with ads, abuse, personal information or illegal content are hidden or removed. Members who post ads, spam, or hateful content are removed from the site, and everything they wrote is deleted. Comments are shown with your nickname. Privacy Policy