How to Sort using Background color of cells in a column

It is very difficult to do it in first attempt. you need to be innovative to do so. To sort by background color , first fetch the color code through script in corresponding neighbour column. Fetching color through app script is easy. Create a function like below

function getHexValue(range) {
  return SpreadsheetApp.getActiveSheet().getRange(range).getBackground();

Now use formula like =getHexValue(A2) where A2 is range of sample cell. This will populate a column and based on value in this column, sort it . Now detailed in steps:

Step 1: Go to tools > Script Editor and create a new function.

script getHexValue to fetch background color of Google sheet cell

Step 2: Apply formula =getHexValue(A2)

Step 3: Sort 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.