The Excel message “To do this, all the merged cells need to be the same size” means the selected range contains merged areas with different dimensions, or a mix of merged and unmerged cells that prevents the requested operation. In Excel for Microsoft 365 on Windows, the most dependable fix is to unmerge the affected cells, complete the operation, and use a non-merged layout if you need the data to remain sortable.
What the merged-cells error means
When you merge cells, Excel combines a rectangular group into one larger cell. For example, merging A1:B1 creates a cell two columns wide, while merging A2:C2 creates one three columns wide. If an operation needs to rearrange cells in a consistent grid, Excel may not be able to move those differently sized merged areas safely. It stops and displays the size-mismatch message instead of guessing how to split or move them.
The wording is about the shape of the merged ranges, not the values in them. It is not a formula error, and changing number formats or recalculating the workbook will not fix it. The usual cause is a worksheet layout that looks orderly to a person but has merged cells spanning different numbers of rows or columns.
When Excel commonly displays the message
Sorting a range is a common trigger. Suppose a report has a title merged across A1:D1 and some rows in the data area also contain merges across different widths. If you select a range containing those merges and try to sort it, Excel may not know how to keep every merged block intact while moving individual records. Similar problems can occur when an operation needs to insert, move, or paste cells into a range whose merged-cell pattern does not match.
The precise trigger depends on the selection and the command. A merged heading outside the selected data range may have no effect on a sort, while a merged cell inside the range can block it. That is why the error can seem inconsistent: the important question is not simply whether the worksheet contains any merged cells, but whether the selected area includes incompatible ones.
Quick fix: unmerge the affected range
For a quick fix, select the range involved in the failed operation and unmerge its cells. In Excel for Microsoft 365 on Windows, use these steps:
- Select the range that produced the error. If you are unsure which cells are involved, select the whole data block, including its headings, but avoid selecting unrelated report sections if possible.
- Go to Home > Merge & Center, open the dropdown beside the command, and choose Unmerge Cells. The command is available in the Alignment group on the Home tab.
- Try the sort, paste, or other operation again. If it still fails, check whether the selected range contains additional merged cells, including merges that extend beyond its visible data columns.
You can also use the same dropdown to unmerge a single selected merged cell. On Excel for Mac, select the range and use the Home tab’s Merge & Center dropdown, then choose Unmerge Cells; the ribbon layout can differ slightly by window size and Excel version. Excel for the web also offers merge and unmerge controls on the Home tab, though some desktop dialog and selection features may be more limited.
How to locate merged cells in a large worksheet
If the sheet is large, finding each merge by eye is unreliable. In desktop Excel, open Home > Find & Select > Find, then choose Options in the Find and Replace dialog. Open Format, go to the Alignment tab, and set the Merge cells option. Use Find All to list matches. Selecting a result takes you to that cell; inspect the range around it to see how far the merge extends.
Find formatting can be easy to overlook. If the dialog already has a format condition from an earlier search, clear that condition before setting the merge option, or the results may not reflect what you intended. After locating the cells, either unmerge only those that intersect the operation’s range or revise the selection so it excludes unrelated merged headings.
For a short worksheet, another practical method is to select the relevant block and choose Unmerge Cells. This is faster than checking each row, but it changes every merged area in that selection, including decorative headings. On Windows, Ctrl+F opens Find; on Mac, Command+F is the usual equivalent. The Find and Replace dialog’s options may be arranged differently on Mac, but searching by cell format is the same general approach.
What happens to the contents when you unmerge
Unmerging restores the separate cells, but it does not recreate values that were removed when the cells were originally merged. Excel keeps the content from the upper-left cell of a merged range; other cell contents are discarded when the merge is made. After unmerging, that upper-left value remains in its original cell and the other cells are blank.
For example, if A1:C1 was merged and displayed the heading “Quarterly sales,” unmerging leaves the heading in A1 and leaves B1 and C1 empty. If the merged area contained an important label, copy or record it before changing the layout. If you have just merged cells and immediately notice that other content disappeared, use Undo (Ctrl+Z on Windows or Command+Z on Mac) before making further edits. Unmerging later cannot recover the discarded entries by itself.
Sorting data after removing merges
Once the data range is unmerged, check that each record occupies its own row and that each field has its own column. For instance, a list with customer names in column A, dates in column B, and amounts in column C is much easier to sort when every row has the same structure. Select a cell in the data and use Data > Sort or the sort controls on the Data tab. If Excel asks whether to expand the selection, include the related columns so values stay with the correct records.
Keep decorative titles and explanatory notes outside the sortable table. If you need a heading above the data, put it in a separate row and do not include that row in the sort selection. A merged title across several columns can be harmless when it is outside the selected sort range; it is merges within the data range, or a selection that includes incompatible merges, that are the concern.
Alternatives to merging cells
Merging is convenient for a visual heading, but it changes the worksheet’s cell structure. For a heading that should appear centered across several columns without combining them, use Center Across Selection instead. Select the cells, open the Format Cells dialog with Ctrl+1 on Windows (Command+1 on Mac), choose the Alignment tab, and set Horizontal to Center Across Selection. The cells remain separate, which is generally friendlier to sorting and editing.
Other practical options include placing a title in one cell and adjusting column widths, or using cell borders and alignment to create a heading without merging. For structured data, avoid merges in the header and body: use one header per column, keep each record on one row, and use formatting such as bold text, fill color, and borders to distinguish sections. These choices make later filtering, sorting, copying, and analysis more predictable.
Common troubleshooting checks
- Check the selected range. Make sure it does not include a merged heading, a summary row, or a neighboring section that is not part of the data.
- Look for merges that cross the edge. A merged range can extend into a column or row you did not expect. Confirm its full outline before sorting or pasting.
- Try unmerging only the data block. If the operation then works, you have narrowed the cause without changing the entire worksheet’s appearance.
- Check for a different error. Excel has other messages involving merged cells, and not every problem is a size mismatch. Read the full message and identify the exact command that triggers it.
If the worksheet is shared or used as a template, consider saving a copy before making broad layout changes. Unmerging does not erase the value retained in the upper-left cell, but it can change the appearance of headings and forms. Review print layout and page breaks after modifying a heavily formatted sheet.
Frequently Asked Questions
How do I fix “To do this, all the merged cells need to be the same size”?
Unmerge the incompatible cells in the selected range using Home > Merge & Center > Unmerge Cells, then repeat the operation. If it persists, inspect the full range for additional merges.
Can I sort a range that contains merged cells?
Excel may block sorting when merged cells in the selected range have different dimensions or do not fit the sort structure. Unmerge cells in the data area and keep headings outside the sort selection for the most reliable result.
Will unmerging cells delete my text?
Unmerging leaves the value from the upper-left cell in that cell and makes the other cells separate and blank. It does not restore other values that were discarded when the cells were first merged.
How can I find every merged cell in Excel?
Use Home > Find & Select > Find, open Options, set the search format on the Alignment tab to Merge cells, and choose Find All. Review the results to locate the affected ranges.
What can I use instead of merged cells?
For a heading centered across columns, try Center Across Selection in Format Cells > Alignment. It preserves separate cells, so the layout is less likely to interfere with sorting and other data operations.
Related
- Excel: Copy Subtotal Rows Only Without Detail Rows
- How to Hyperlink to Another Cell in Excel
- How to Group Rows in Excel and Hide Them
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Excel YEAR Function Not Working? Fix Dates and ResultsIf Excel’s year-today formula is not working, enter =YEAR(TODAY()) in a cell formatted as General or Number; it…
- Excel Formula Not Working? Find and Fix Common ErrorsIf an Excel formula is not working, check that the cell contains a formula rather than text, confirm…
- Excel Filter Not Working? How to Find and Fix the CauseIf your Excel filter is not working, first check that the filter covers the entire data range, that…
- Excel CSV Import Problems? Fix Dates, Delimiters & MoreFor most Excel CSV import problems, avoid opening the file by double-clicking it. In Excel for Microsoft 365…
- Excel OLE Action Error: What It Means and How to Fix ItThe Excel OLE action error means Excel is waiting for another program to respond, usually an app or…
- Excel Filter A to Z Not Working? Fix the SortIf Excel’s A to Z command is not sorting the records you expect, first click a cell in…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.