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

or

如何通过删除线在Excel中对数据进行排序或过滤?

在Excel中,我们通常使用删除线来格式化数据,以指示不再需要的项目。 有时,我们需要对包含删除线的数据进行过滤或排序,以便快速处理这些行。 有没有什么快速的技巧,我们可以通过删除线来排序或过滤数据?

使用用户自定义功能删除数据,对数据进行排序或过滤

通过删除线与Kutools for Excel过滤数据


通过删除线快速轻松地过滤数据:

Kutools for Excel's 过滤删除线 实用程序可以帮助您快速轻松地过滤所有格式化为删除线的单元格。

doc-sort-by-strikethrough 14

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


箭头蓝色右泡 使用用户自定义功能删除数据,对数据进行排序或过滤


不幸的是,我们没有直接的方法来排序或过滤使用删除线数据 排序 or 筛选 功能,但是,我们可以创建一个简单的 用户自定义函数 先用删除线标记数据,然后应用排序或过滤功能。

假设我有如下屏幕截图所示的删除线数据,可以使用以下步骤对删除线数据进行排序或过滤:

DOC排序按strikethrough1

1。 按住 ALT + F11 键打开 Microsoft Visual Basic for Applications窗口.

2。 点击 插页 > 模块,并将以下代码粘贴到 模块窗口.

Function HasStrike(Rng As Range) As Boolean
HasStrike = Rng.Font.Strikethrough
End Function

3。 然后保存并关闭此窗口,在数据旁边的空白单元格中,请输入此公式 = HasStrike(A2)在这种情况下,我将把它输入到单元格C2。 看截图:

DOC排序按strikethrough1

注意:在上面的公式中, A2 是需要识别的格式是否为删除线的值。 您可以根据需要更改它。

4。 然后将填充句柄拖到要应用此公式的单元格中。 如下图所示,您可以看到,如果数据被格式化为删除线,则显示为 TRUE,正常数据显示为 FALSE.

DOC排序按strikethrough1

5。 那么你可以通过这个新的列C进行排序或过滤。

答:在记录底部或顶部对删除线数据进行排序:

(1。) 点击 数据 > 排序,看截图:

DOC排序按strikethrough1

(2。) 然后在弹出 排序警告 对话框,检查 展开选择 选项。

DOC排序按strikethrough1

(3。) 然后点击 排序 按钮,在 排序 对话框中选择 C栏 这是您新建立的专栏 下拉列表,然后选择 价值观 在下面 排序 选项,最后选择 关于产品订购 你想排序。 看截图:

DOC排序按strikethrough1

(4。) 然后点击 OK 关闭这个对话框,并且删除线数据已经被排序在值的底部。 看截图:

DOC排序按strikethrough1

小技巧:如果要将删除线数据排序到所有数据的顶部,只需在步骤3中选择Largest to Smallest即可。

B:通过删除线过滤记录

(1。) 选择您的整个数据范围,在这里我选择范围A1:C14,然后单击 数据 > 筛选,看截图:

DOC排序按strikethrough1

(2。) 然后点击单元格C1旁边的下拉按钮,然后检查 TRUE 选项,请参阅截图:

DOC排序按strikethrough1

(3。) 然后点击 OK,所有的删除线数据已被过滤。

DOC排序按strikethrough1

注意:完成排序和筛选后,可以删除C列中的值。


箭头蓝色右泡 通过删除线与Kutools for Excel过滤数据

如果你有 Kutools for Excel,其 过滤删除线 功能,您可以快速过滤所有格式为删除线的单元格。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

安装后 Kutools for Excel,请这样做:

1。 选择您想用删除线过滤单元格的列,然后单击 Kutools Plus > 特殊过滤器 > 过滤删除线,看截图:

DOC排序按strikethrough1

2。 然后,会弹出一个提示框,提醒您有多少个单元格与条件匹配,请参阅截图:

DOC排序按strikethrough1

3。 然后点击 OK 按钮,所有用删除线形成的单元格都会被滤除,请参阅截图:

DOC排序按strikethrough1

点击下载Kutools for Excel和免费试用版吧!


相关文章:

如何在Excel中按奇数或偶数排序行?

如何对行进行排序,将空白单元格放在Excel中?

如何通过Excel中最频繁的值对数据进行排序?

如何在Excel中按域分类电子邮件地址?


Kutools for Excel解决了您的大多数问题,并使您的生产率提高了80%

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能30天免费试用。
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.
    Nat · 7 months ago
    This is perfect, thank you!
  • To post as a guest, your comment is unpublished.
    Niko · 11 months ago
    Well done, thank you!
  • To post as a guest, your comment is unpublished.
    Rix · 2 years ago
    You can filter with MS Excel without having to do this script.
    Just Ctrl-F Find, Search by Format, Strikethrough checkbox, Find All, Then Select All (Crtl-A), then hide (Crtl-9).
    • To post as a guest, your comment is unpublished.
      Phil · 1 months ago
      I tried this but it crashed, seems when there is a lot of data it is really slow
  • To post as a guest, your comment is unpublished.
    Dawn · 2 years ago
    I'm getting #NAME? instead of True or False
  • To post as a guest, your comment is unpublished.
    Dawn · 2 years ago
    I tried this and I first got a message that my sheet needed to be saved as one with macros.
    I saved it as xlsm
    Then I pasted the =HasStrike(A2) and it gave me #NAME? in the cell.
    What am I doing wrong?
    Thnaks!
  • To post as a guest, your comment is unpublished.
    HS · 2 years ago
    Thanks a bunch for this, you have saved me a few hours of manual labour!
    • To post as a guest, your comment is unpublished.
      Sinan · 2 years ago
      well that worked perfectly. Thank you very much
  • To post as a guest, your comment is unpublished.
    Don · 3 years ago
    well that worked perfectly. THANKS.
  • To post as a guest, your comment is unpublished.
    Adib · 3 years ago
    Thank you very much! This saved my day!
  • To post as a guest, your comment is unpublished.
    Katia · 3 years ago
    Thank you!!!
    Exactly what I need ;)
  • To post as a guest, your comment is unpublished.
    TG · 3 years ago
    This surprisingly helped!! THANKS ALOT !
  • To post as a guest, your comment is unpublished.
    Nuno Ferreira · 3 years ago
    It worked great!
    Thanks for the tips!!!
  • To post as a guest, your comment is unpublished.
    Nuno Ferreira · 3 years ago
    It worked great!
    Thanks alot!
  • To post as a guest, your comment is unpublished.
    Paula · 3 years ago
    This was very helpful and exactly what I needed. Thanks!!
  • To post as a guest, your comment is unpublished.
    Matt P · 3 years ago
    This was awesome and saved me hours, thank you.
  • To post as a guest, your comment is unpublished.
    Purvi · 3 years ago
    Brilliant this was very helpful.
    Thanks :-)
  • To post as a guest, your comment is unpublished.
    Evan · 3 years ago
    This is awesome...but...I would also like to work it if ANY portion of the text in the cell contains a strikethrough. This code works ONLY if the ENTIRE cell has been "struck out". How would this code need to be modified to accomplish this??
    • To post as a guest, your comment is unpublished.
      HS · 2 years ago
      Good question, I faced same issue.

      Temporary Workaround - The cell with text which hasn't been completely stricken through creates a (#VALUE!) error as opposed to (TRUE) statement but you can still use this Value Error to identify the cells with strikethroughs.
  • To post as a guest, your comment is unpublished.
    JT · 4 years ago
    This was very very helpful!

    Thank you!
  • To post as a guest, your comment is unpublished.
    Avishek · 5 years ago
    Great.. Thanks a ton..