How to Sort Excel Data with Merged Cells and Pictures
Question details
The user needs to sort a table in Excel that contains both irregularly sized merged cells and inserted 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 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.
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.
Select the entire range of your table. Go to the Home tab, click the Merge & Center dropdown, and select Unmerge 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.
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.
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.

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. Open your file in WPS: Launch WPS Spreadsheet and open your document.
- 2. Unmerge cells: Highlight the affected area, go to the Home tab, and click the 'Merge and Center' button to unmerge them.
- 3. Adjust image settings: Right-click the pictures, select 'Format Object', and set them to 'Move and size with cells'.
- 4. Sort your dataset: Highlight your data and use the 'Sort' function under the Data tab to organize the rows perfectly.

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.




