跳到主要內容

如何在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,正常數據顯示為 .

doc-by-strikethrough1

5。 然後,您可以按此新列C進行排序或過濾。

答:在記錄的底部或頂部對刪除線數據進行排序:

(1。) 點擊 數據 > 分類,請參見屏幕截圖:

doc-by-strikethrough1

(2。) 然後在彈出 排序警告 對話框,檢查 擴大選擇 選項。

doc-by-strikethrough1

(3。) 然後點擊 分類 按鈕,在 分類 對話框中選擇 C列 這是您從中新創建的列 下拉列表,然後選擇 價值觀排序 選項,最後選擇 過往訂單 您想排序。 看截圖:

doc-by-strikethrough1

(4。) 然後點擊 OK 關閉此對話框,並且刪除線數據已在值的底部排序。 看截圖:

doc-by-strikethrough1

尖端:如果要將刪除線數據排序到所有數據的頂部,只需在步驟3中選擇“最大”到“最小”即可。

B:按刪除線過濾記錄

(1。) 選擇您的整個數據范圍,在這裡我選擇範圍A1:C14,然後單擊 數據 > 篩選,請參見屏幕截圖:

doc-by-strikethrough1

(2。) 然後單擊單元格C1旁邊的下拉按鈕,然後只需檢查 TRUE 僅選項,請參見屏幕截圖:

doc-by-strikethrough1

(3。) 然後點擊 OK,並且所有刪除線數據均已過濾。

doc-by-strikethrough1

備註:完成排序和過濾後,您可以刪除列C中的值。


箭頭藍色右氣泡 使用Kutools for Excel通過刪除線過濾數據

如果你有 Excel的Kutools,其 過濾刪除線 功能,您可以快速過濾所有格式為刪除線的單元格。

注意:要應用此 過濾刪除線,首先,您應該下載 Excel的Kutools,然後快速輕鬆地應用該功能。

安裝後 Excel的Kutools,請這樣做:

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選項卡為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