Formula Errors

How to Sort Duplicate Rows Highlighted in Red in Excel

Anum MushtaqAnum Mushtaq Nov 3, 2026 869 views

Question details

The user needs a method to group or sort duplicate rows together after they have been highlighted with red cell formatting.

How to Sort Duplicate Rows Highlighted in Red in Excel
Product
Excel
Device & OS
not provided
Scenario
Organizing and reviewing a dataset where duplicate entries have already been identified and marked with red highlights.
Observed behavior
Duplicate rows are currently scattered throughout the worksheet and need to be brought together for easier viewing, management, or deletion.
Before you start

Ensure your dataset has clear column headers and no completely blank rows to prevent sorting errors. If you haven't highlighted the duplicates yet, you will need to apply Conditional Formatting first.

Solution 1Recommended

Use Custom Sort by Cell Color

The most straightforward way to group red-highlighted duplicates is to use the Custom Sort feature to arrange rows based on their cell color rather than their text values.

This built-in tool brings all rows containing a specific background color to the top or bottom of your dataset. It requires that your duplicate values already have the red formatting applied.

1
Select the dataset

Click any cell within the column containing the highlighted duplicates, or select your entire data range manually.

2
Open the Custom Sort menu

Navigate to the Home tab on the ribbon. Click on Sort & Filter in the Editing group, and select Custom Sort from the dropdown menu.

3
Configure the color sorting rules

In the Sort dialog box, select your target column under the 'Column' dropdown. Change the 'Sort On' dropdown from Cell Values to 'Cell Color'. Finally, pick the red highlight color under the 'Order' option and choose whether to place it 'On Top' or 'On Bottom', then click OK.

Use Custom Sort by Cell Color
Keep Data Intact: Always ensure the 'My data has headers' box is checked in the Sort dialog if your selection includes the title row, so your headers aren't mixed into the sorted data.
Efficient Data Management

Sort and Manage Duplicates Seamlessly in WPS Spreadsheet

WPS Office offers intuitive tools to highlight, sort, and manage duplicate data exactly like Microsoft Excel. It handles complex datasets effortlessly while offering a clean, user-friendly interface.

  1. 1. Highlight Duplicate Values: Select your data range, navigate to Home > Conditional Formatting > Highlight Cells Rules, and select 'Duplicate Values' to apply a red fill.
  2. 2. Open Custom Sort: Go to the Data tab and click the 'Sort' icon to open the advanced sorting dialog box.
  3. 3. Sort by Cell Color: Select your target column, set 'Sort On' to 'Cell Color', pick the red fill, and click OK to instantly group all duplicates together.
100% format compatibility with Microsoft Excel (.xlsx, .xls, .csv)Built-in 'Highlight Duplicates' conditional formatting toolAdvanced Custom Sort by cell color, font color, or custom listsFree, lightweight, and cross-platform for Windows, Mac, and Linux
QA img-9

Frequently Asked Questions

Can I sort by multiple cell colors at once?

Yes. In the Custom Sort dialog box, click 'Add Level' to create secondary sorting rules. You can define a hierarchy to sort by red cells first, then yellow cells, and so on.

Why did my Custom Sort mix up my row data?

This happens if you only select a single column instead of the entire dataset before sorting. When prompted, always choose 'Expand the selection' to ensure entire rows stay linked together during the sort.

How do I delete the red duplicate rows after sorting them together?

Once sorted, all red rows will be grouped in one continuous block. Select the row numbers on the far-left side for all the red rows, right-click, and select 'Delete'. Alternatively, you can use the built-in 'Remove Duplicates' tool found on the Data tab.