Excel can sort by more than text, numbers, and dates. If you use fill colors, font colors, or conditional-formatting icons to mark priorities or categories, Excel can group those marked rows together automatically.
Does this affect you?
Use this for Excel for Microsoft 365, Excel 2021, and Excel 2019 on Windows or Mac when colored cells should be grouped or prioritized without dragging rows manually.
Sort a range by cell color
Use the full Sort dialog when you need a specific color order.
- Click any cell inside the data range.
- Open the Data tab and click Sort.
- Set Column to the column containing the colors.
- Change Sort On from Cell Values to Cell Color.
- In Order, choose the first color to place at the top.
- Click Add Level for each additional color and arrange the order you want.
- Click OK.
Excel moves whole rows so the chosen colors group together. Cells with no fill color usually fall after the colored groups unless you choose a different order.
Sort by font color or icons
The same dialog handles other visual markers.
- Open Data > Sort.
- Choose the column with the colored text or conditional-formatting icons.
- Change Sort On to Font Color or Conditional Formatting Icon.
- Choose the color or icon order.
- Click OK.
More control
Put one color on top quickly
Right-click a cell with the color you care about, choose Sort, then choose Put Selected Cell Color On Top. This is faster than building a full multi-color sort.
Sort within each color group
In the Sort dialog, sort by color first, then click Add Level and add a normal values sort, such as date or name. Excel groups the color first and sorts within each group second.
Conditional formatting colors work
Colors created by conditional-formatting rules can be sorted just like manual fills. Select Cell Color, Font Color, or Cell Icon under Sort On.
Sources
- Microsoft Support – Sort data in a range or table (2025)
- Microsoft Support – Filter by using conditional formatting (2025)
- Microsoft Support – Apply or remove cell borders and shading (2024)
