Can Excel Sort by Color? How to Fill Color and use Sort & Filter's Custom Sort

Excel can sort by cell color, font color, cell icon, and values.

Credit: Rob Schultz

Can Excel sort by color? Absolutely. In addition to sorting by values, Excel can sort by cell color, font color, and cell icon.

First, you must you must define the colors for your sort columns/fields. For this example, we’ll select colors based on the SALES column.

1. Highlight all the rows with sales from 100 to 500 million. To choose a background color, click Home on the main menu row and go to the Font group. Find the paint-bucket icon that stands for Fill Color, and click the down arrow next to it. A color palette appears, from which you may choose a color by clicking its thumbnail. For our example, we've chosen Yellow from the Standard Colors group.

2. Highlight the next group with sales from 77 to 85 million, then choose Blue.

3. From 60 to 65 million, choose green; for 50 million, choose Orange; choose lavender for 40 to 45 million, and cyan (turquoise) from 30 to 39 million

01 choose colors for each specific range JD Sartain / IDG Worldwide

Choose colors for each specific range

Now that the colors are defined by SALES, you can use them to sort by BOOK, AUTHOR, LANGUAGE, or PUB DATE, and, for example, view authors with sales of Cyan, which denotes the group with sales between 30 and 39 million.

1. Move the cursor anywhere inside the data range, press Ctrl+A to highlight everything.

2. From the Home tab on the main menu, select the Editing group. Click Sort & Filter > Custom Sort and the Sort dialog box opens.

3. If you have headers, be sure to check the box that says: My data has headers.

4. Choose a sort key from the Sort By field box under Column, such as Author.

5. Under Sort On, choose Cell Color from the drop-down list.

6. Under Order, choose the thumbnail for the color by which you wish to sort—in our example, it's cyan. 

7. And, in the last field box, choose On Top, which sorts the selected rows to the top of the spreadsheet (choosing On Bottom sorts the selected rows to the bottom).

8. Next, click the Add Level button, which adds a second sort key to the query.

9. From left to right, choose AUTHOR, Cell Values, A to Z, and click OK.

02 sort spreadsheet range by color first then by author JD Sartain / IDG Worldwide

Sort spreadsheet range by color first, then by AUTHOR

Notice that all the Cyan cells (30 to 39 million in SALES) are sorted to the top of the spreadsheet and then alphabetized by AUTHOR within the Cyan colored cells. The rest of the spreadsheet is sorted by AUTHOR only with all the remaining SALES totals (except 30 to 39 million).

03 cyan cells sorted to the top alphabetized by authors name JD Sartain / IDG Worldwide

Cyan cells sorted to the top alphabetized by AUTHOR’s name

For more samples and detailed instructions regarding sorting by colors, values, and icons, and using conditional formatting, check out these two past articles: How to use Microsoft Excel's conditional formatting, and How to customize Excel conditional formatting.

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags Office 2013Office 2016

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

JD Sartain

PC World (US online)
Show Comments

Most Popular Reviews

Latest Articles


PCW Evaluation Team

Tom Pope

Dynabook Portégé X30L-G

Ultimately this laptop has achieved everything I would hope for in a laptop for work, while fitting that into a form factor and weight that is remarkable.

Tom Sellers


This smart laptop was enjoyable to use and great to work on – creating content was super simple.

Lolita Wang


It really doesn’t get more “gaming laptop” than this.

Jack Jeffries


As the Maserati or BMW of laptops, it would fit perfectly in the hands of a professional needing firepower under the hood, sophistication and class on the surface, and gaming prowess (sports mode if you will) in between.

Taylor Carr


The MSI PS63 is an amazing laptop and I would definitely consider buying one in the future.

Christopher Low

Brother RJ-4230B

This small mobile printer is exactly what I need for invoicing and other jobs such as sending fellow tradesman details or step-by-step instructions that I can easily print off from my phone or the Web.

Featured Content

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?