Formatting Issues

How to Sort Excel Data with Merged Cells and Pictures

John WilsonJohn Wilson Nov 10, 2026 869 views

Question details

The user needs to sort a table in Excel that contains both irregularly sized merged cells and inserted pictures.

How to Sort Excel Data with Merged Cells and Pictures
Product
Excel
Device & OS
not provided
Scenario
Attempting to sort a dataset that includes merged cells and floating images, causing structural conflicts and layout breakage.
Observed behavior
Excel prevents sorting because merged cells have inconsistent sizes, and pictures may not move properly with their corresponding rows when sorted.
Before you start

Before proceeding, adjust the height of your rows to ensure each picture fits entirely inside its respective cell, which is crucial for images to sort properly with the data.

Solution 1Recommended

Unmerge Cells, Anchor Pictures, and Sort Data

Resolve structural conflicts by unmerging all cells and properly attaching your pictures to their rows before running the sort command.

Excel requires a uniform grid structure to perform sorting operations. Merged cells disrupt this grid, and floating pictures can easily become misaligned if they are not specifically anchored to the cells they belong to.

1
Unmerge all cells

Select the entire range of your table. Go to the Home tab, click the Merge & Center dropdown, and select Unmerge Cells.

2
Anchor images to cells

Right-click each image in your table and select Format Picture. Under the Size & Properties icon, choose the Properties section and check 'Move and size with cells'. Ensure each image is resized so it does not overlap cell borders.

3
Sort the data

Select the entire data range again. Navigate to the Data tab, click Sort, and choose the specific column you want to organize your data by.

4
Use Center Across Selection

If you need a merged visual effect for headers, select the cells, right-click and choose Format Cells. Under the Alignment tab, set the Horizontal text alignment to 'Center Across Selection' instead of merging them.

Unmerge Cells, Anchor Pictures, and Sort Data
Pro Tip: Using 'Center Across Selection' is highly recommended as a permanent replacement for merged cells. It gives you the exact same visual appearance but leaves the underlying cells intact, preventing future sorting and filtering errors.
Organize Data Seamlessly

Easily Sort Complex Data in WPS Office

WPS Spreadsheet provides powerful data handling tools, allowing you to easily unmerge cells, adjust image properties, and sort your data accurately without disrupting your layout.

  1. 1. Open your file in WPS: Launch WPS Spreadsheet and open your document.
  2. 2. Unmerge cells: Highlight the affected area, go to the Home tab, and click the 'Merge and Center' button to unmerge them.
  3. 3. Adjust image settings: Right-click the pictures, select 'Format Object', and set them to 'Move and size with cells'.
  4. 4. Sort your dataset: Highlight your data and use the 'Sort' function under the Data tab to organize the rows perfectly.
Sort data with merged cells and pictures flawlessly.Fully compatible with Microsoft Excel (.xlsx) formats.Free and lightweight alternative for complex data management.Intuitive formatting options like 'Center Across Selection'.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel say 'To do this, all the merged cells need to be the same size'?

This error occurs because sorting requires a uniform grid. Merged cells combine multiple rows or columns, disrupting the standard row-and-column structure Excel expects. You must unmerge the cells before sorting.

How can I center text across columns without merging cells?

Select the cells you want the text to span across, right-click, and choose 'Format Cells'. Go to the Alignment tab, and under the Horizontal dropdown menu, select 'Center Across Selection'.

Why do my pictures pile up or stay in place when I sort data?

By default, pictures might float over the worksheet instead of being attached to specific cells. You need to right-click the image, select Format Picture, go to Properties, and select 'Move and size with cells' so the image moves with the sorted row.