提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何根据Google表格中的单元格颜色过滤行?

通常情况下,我们可以使用Filter功能在Excel中快速筛选特定颜色的行,但在Google工作表中,Filter功能不支持此操作。 本文将讨论如何在Google工作表中按颜色过滤行。

根据Google表格中的颜色过滤行


根据Google表格中的颜色过滤行


请应用以下步骤根据颜色过滤数据。

1。 点击 > 脚本编辑器,看截图:

2。 在打开的项目窗口中,请复制并粘贴以下脚本代码以替换代码模块中的原始代码,请参见屏幕截图:

function getHex(input) {
  return SpreadsheetApp.getActiveSpreadsheet().getRange(input).getBackgrounds();
}

3。 然后保存代码窗口,并弹出一个提示框提醒您为该项目命名,请参见截图:

4。 保存脚本代码后,返回表单并输入以下公式: = getHex( “A2:A16”) 放到数据范围旁边的空白单元格中,然后按 输入 键,每行的颜色索引已显示在助手列中,请参见截图:

5。 然后,您只需根据此帮助程序列筛选行,请单击帮助程序列标题,然后单击 数据 > 筛选,看截图:

6。 然后单击助手列中的下拉按钮,在展开窗格中选择并检查要从列表框中过滤的颜色索引,请参阅截图:

7。 点击 OK 按钮,填充特定单元格颜色的行将按照以下屏幕截图进行过滤:


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ankit · 5 days ago
    Thanks a lot! It helped.
  • To post as a guest, your comment is unpublished.
    David Cardoso · 13 days ago
    Superb! very useful! Thanks a million! Cheers!
  • To post as a guest, your comment is unpublished.
    Volkan Yılmaz · 28 days ago
    Thank you. Awesome
  • To post as a guest, your comment is unpublished.
    ian · 3 months ago
    there's a question that it kept showing "Range not found",how can i fix it
  • To post as a guest, your comment is unpublished.
    Henrique · 5 months ago
    Awesome job, it works exactly like the explanation.Thank you
  • To post as a guest, your comment is unpublished.
    Bob Thomas · 5 months ago
    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!
  • To post as a guest, your comment is unpublished.
    Ramón · 5 months ago
    I understand that the topic is about a script for such a need. But a simpler option can be to handle conventions by color. Example: Green color indicates CLIENT, Color Orange. INTERESTED, Color Yellow indicates NOT INTERESTED .. Then add a column status and then filter for the desired state.
  • To post as a guest, your comment is unpublished.
    Tarek Allam · 6 months ago
    This is a great script it really helped me solve a problem, however I modified it a bit because my range is not fixed, I keep adding rows to the sheet and I don't want to modify the formula everytime I add a new row, so I used the following formula instead:

    =ARRAYFORMULA(IF(NOT(ISBLANK(A2:A)),getHex("A2:A"),""))

    The problem is when I change the color of a column the hex value does not change even if I refresh the sheet, the only solution I found is to delete the formula then paste it again so it loads again, anyone could help with a solution to this?
  • To post as a guest, your comment is unpublished.
    Tarek · 6 months ago
    This is a great script it really helped me solve a problem, however I modified it a bit because my range is not fixed, I keep adding rows to the sheet and I don't want to modify the formula everytime I add a new row, so I used the following formula instead:

    =ARRAYFORMULA(IF(NOT(ISBLANK(A2:A)),getHex("A2:A"),""))

    The problem is when I change the color of a column the hex value does not change even if I refresh the sheet, the only solution I found is to delete the formula then paste it again so it loads again, anyone could help with a solution to this?
  • To post as a guest, your comment is unpublished.
    Filip · 7 months ago
    i want use it, but dont working :-/
  • To post as a guest, your comment is unpublished.
    Polynon · 7 months ago
    Just a note if this isn't working for you, the quotation marks used in the example above don't parse a formula correctly and give you a "Formula Parse Error".

    The correct one is:

    =getHex("A2:A16")

    rather than:

    =getHex(“A2:A16”)
    • To post as a guest, your comment is unpublished.
      skyyang · 7 months ago
      Hi, Polynon,
      Thank you for your comment, the double quote around the cell reference should be English punctuation.
      I have updated it.
  • To post as a guest, your comment is unpublished.
    Lydia · 1 years ago
    Top, Danke!