Skip to main content

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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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...

Description


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!
Comments (17)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
See also how-to-pass-a-range-into-a-custom-function-in-google-spreadsheets
https://webapps.stackexchange.com/questions/10629/how-to-pass-a-range-into-a-custom-function-in-google-spreadsheets

This then gives for example

=getHex(CELL("address",A1))
=getHex(CELL("address",A1)&":"&CELL("address",A2))

etc
This comment was minimized by the moderator on the site
What if only certain cells in a row were colored? How can I use this method to notate which ROWS contain a particular color?
This comment was minimized by the moderator on the site
It worked for me, but not for alle colors. I don't know why.
But anyway: Thank a lot!
This comment was minimized by the moderator on the site
ty it works
This comment was minimized by the moderator on the site
Thanks a lot! It helped.
This comment was minimized by the moderator on the site
Superb! very useful! Thanks a million! Cheers!
This comment was minimized by the moderator on the site
Thank you. Awesome
This comment was minimized by the moderator on the site
there's a question that it kept showing "Range not found",how can i fix it
This comment was minimized by the moderator on the site
Awesome job, it works exactly like the explanation.Thank you
This comment was minimized by the moderator on the site
Great workaround! I tried repeatedly to highlight duplicates in an Excel spreadsheet then sort by cell color but since the file was so large (373K + rows) the sort would "hang", and never complete. I decided to try Google Sheets and although I could only format about 100K rows at a time (had to do a format 4x) your workaround worked perfectly. Plus, scrolling down the page with Google Sheets was infinitely faster than with Excel. Thanks for the great hack!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations