Ever found yourself drowning in a sea of colors in Google Sheets, wishing you could bring order to the chaos? Well, you're in luck! Custom sorting by color in Google Sheets is not only possible but also quite straightforward. Let's embark on this color-coded journey together.

Before we dive into the nitty-gritty, let's ensure we're starting with the right tools. You'll need version 25 or newer of Google Sheets for this guide. Don't worry, Google Sheets automatically updates, so you should be good to go.

Understanding Conditional Formatting
To sort by color, we'll first apply conditional formatting to our data. This feature allows Google Sheets to change the formatting of cells based on specified rules.

Let's say we have a column of values (A1:A10) and we want to apply a color to cells containing 'apple'. We'll create a rule like this: "If the value of the cell is 'apple', then make the background color red".
Applying Conditional Formatting

To apply this rule, click 'Format' in the menu, then 'Conditional formatting'. Under the 'Format cells if...' dropdown, select 'Text is equal to', then 'apple'. In the 'Formatting style' dropdown, choose the fill color you want. Finally, click 'Done'.
Now, every cell containing 'apple' in column A will be colored red. Repeat this process for other values or conditions.
Sorting by Color

Now that our data is color-coded, let's sort it by color. Select the column you've applied conditional formatting to (A1:A10). Go to 'Data' in the menu, then 'Sort A→Z' or 'Sort Z→A'.
But wait! Sorting alphabets is not what we want. To sort by color, we need to use the ABC way.
Using the ABC Way to Sort by Color

The ABC way, or ABC sorting, sorts data by the ASCII values of characters. Since colors correspond to different ASCII values, this method sorts cells based on their color.
In our example, 'apple' cells are red, which corresponds to ASCII value 1. Let's sort all 'apple' cells to the top, then sort 'banana' cells (not colored) to the bottom.




















Creating an ABC Column
In a new column, say B, enter the formula {"="&CHAR(97)} (without quotes). This converts all entries to 'a', meaning ASCII value 1. This works because we've already applied conditional formatting.
Now, sort column B (A→Z) to bring all 'apple' cells to the top. Then, sort column B (Z→A) to bring all other cells to the bottom. Tada! Your data is now sorted by color.
Removing the ABC Column
To hide or remove the ABC column, click on it and go to 'Format' in the menu, then 'Clear formatting'. This removes the formula and the color, hiding the sort rule from view.
Alternatively, you can create a new sheet, copy your sorted data into it, and clear the formatting there. This keeps your original data intact.
And there you have it! You've just sorted your data by color in Google Sheets. Now go forth and paint your spreadsheets with order and organization. Happy sorting!