跳到主要内容

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

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

使用用户定义的功能按删除线对数据进行排序或过滤

使用 Kutools for Excel 按删除线过滤数据


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

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

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

doc-by-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-by-strikethrough1

备注:在以上公式中, A2 是您需要识别的值,如果它的格式设置为删除线。 您可以根据需要进行更改。

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

doc-by-strikethrough1

5。 然后,您可以按此新列C进行排序或过滤。

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

(1。) 点击 时间 > 排序,请参见屏幕截图:

doc-by-strikethrough1

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

doc-by-strikethrough1

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

doc-by-strikethrough1

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

doc-by-strikethrough1

Tips::如果要将删除线数据排序到所有数据的顶部,只需在步骤3中选择“最大”到“最小”即可。

B:按删除线过滤记录

(1。) 选择整个数据范围,在这里我选择范围A1:C14,然后单击 时间 > 筛选器,请参见屏幕截图:

doc-by-strikethrough1

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

doc-by-strikethrough1

(3。) 然后点击 OK,并且所有删除​​线数据均已过滤。

doc-by-strikethrough1

备注:完成排序和过滤后,您可以删除列C中的值。


箭头蓝色右气泡 使用 Kutools for Excel 按删除线过滤数据

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

请注意:申请这个 过滤删除线,首先,您应该下载 Kutools for Excel,然后快速轻松地应用该功能。

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

1。 选择要用删除线过滤单元格的列,然后单击 Kutools 加 > 特殊过滤器 > 过滤删除线,请参见屏幕截图:

doc-by-strikethrough1

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

doc-by-strikethrough1

3。 然后点击 OK 按钮,所有带有删除线格式的单元格都会被滤除,请参见屏幕截图:

doc-by-strikethrough1

单击立即下载 Kutools for Excel 并免费试用!


相关文章:

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

如何对行进行排序以将空白单元格放在Excel的顶部?

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

如何在Excel中按域对电子邮件地址进行排序?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (24)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Werkt geweldig. Bedankt. Echter, hoe kan ik de file weer saven als .xlsx file. Ik krijg telkens een foutmelding als ik dit doe. Dank je.
This comment was minimized by the moderator on the site
Hi, Carine,
Because there is VBA code in the workbook, when you close the workbook, you should save this workbook as Excel Macro-Enabled Workbook (*.xlsm) format.
When opening this workbook next time, please click the Enable Content at the top of the formula bar to activate the code.
PPlease try, hope it can help you!
This comment was minimized by the moderator on the site
Thanks, it worked
This comment was minimized by the moderator on the site
This is perfect, thank you!
This comment was minimized by the moderator on the site
Well done, thank you!
This comment was minimized by the moderator on the site
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).
This comment was minimized by the moderator on the site
I tried this but it crashed, seems when there is a lot of data it is really slow
This comment was minimized by the moderator on the site
I'm getting #NAME? instead of True or False
This comment was minimized by the moderator on the site
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!
This comment was minimized by the moderator on the site
Thanks a bunch for this, you have saved me a few hours of manual labour!
This comment was minimized by the moderator on the site
well that worked perfectly. Thank you very much
This comment was minimized by the moderator on the site
well that worked perfectly. THANKS.
This comment was minimized by the moderator on the site
Thank you very much! This saved my day!
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