How to filter rows based on cell color in Google sheet?
Normally, we can filter rows by a certain color in Excel quickly with the Filter feature, but, in Google sheet, the Filter function does not support this operation. This article, I will talk about how to filter rows by color in Google sheet.
Filter rows based on color in Google sheet
Filter rows based on color in Google sheet
Please apply the following steps to filter data based on color.
1. Click Tools > Script editor, see screenshot:
2. In the opened project window, please copy and paste the below script code to replace the original code in the code module, see screenshot:
function getHex(input) {
return SpreadsheetApp.getActiveSpreadsheet().getRange(input).getBackgrounds();
}
3. And then save the code window, and a prompt box is popped out to remind you to give the project a name, see screenshot:
4. After saving the script code, go back the sheet, and enter this formula: =getHex("A2:A16") into a blank cell next to your data range, and then press Enter key, the color index of each row has been displayed in the helper column, see screenshot:
5. Then you just need to filter rows based on this helper column, please click the helper column header, and then click Data > Filter, see screenshot:
6. And then click the drop-down button in the helper column, in the expanded pane, choose and check the color index that you want to filter from the list box, see screenshot:
7. Click the OK button, the rows which filled with the specific cell color have been filtered as following screenshot shown:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!










