跳到主要內容

如何在Excel中從一個列表中排除另一個列表中的值?

假設您有兩個數據列表,如左圖所示。 現在,如果D列中存在名稱,則需要刪除或排除A列中的名稱。如何實現? 如果兩個列表位於兩個不同的工作表中怎麼辦? 本文為您提供了兩種方法。

使用公式從一個列表中排除另一個列表中的值

使用Kutools for Excel快速將一個列表中的值從另一個列表中排除


使用公式從一個列表中排除另一個列表中的值

您可以應用以下公式來實現。 請執行以下操作。

1.選擇一個與要刪除的列表的第一個單元格相鄰的空白單元格,然後輸入公式 = COUNTIF($ D $ 2:$ D $ 6,A2) 進入編輯欄,然後按 Enter 鍵。 看截圖:

備註:在公式中,$ D $ 2:$ D $ 6是您將基於其刪除值的列表,A2是要刪除的列表的第一個單元格。 請根據需要更改它們。

2.繼續選擇結果單元格,向下拖動“填充手柄”直到其到達列表的最後一個單元格。 看截圖:

3.繼續選擇結果列表,然後單擊 數據 > 將A到Z排序.

然後您可以看到列表按如下所示的屏幕截圖排序。

4.現在選擇名稱為結果1的整行,右鍵單擊所選範圍,然後單擊 刪除 刪除它們。

現在,您已經在一個基於另一個列表的列表中排除了值。

備註:如果“ to-remove-list”位於另一個工作表(如Sheet2)的A6:A2範圍內,請應用此公式 = IF(ISERROR(VLOOKUP(A2,Sheet2!$ A $ 2:$ A $ 6,1,FALSE)),“保持”,“刪除”) 得到所有 保持刪除 結果,請繼續對Ato Z中的結果列表進行排序,然後手動刪除包含當前工作表中“刪除結果”的所有名稱行。


使用Kutools for Excel快速將一個列表中的值從另一個列表中排除

本節將推薦 選擇相同和不同的單元格 的效用 Excel的Kutools 解決這個問題。 請執行以下操作。

申請前 Excel的Kutools首先下載並安裝.

1。 點擊 庫工具 > 選擇 > 選擇相同和不同的單元格。 看截圖:

2。 在裡面 選擇相同和不同的單元格 對話框,您需要:

  • 2.1選擇要從中刪除值的列表 在中查找值 框;
  • 2.2在列表中選擇要刪除的值的列表 根據 框;
  • 2.3選擇 單細胞 在選項 基於 部分;
  • 2.4點擊 OK 按鈕。 看截圖:

3.然後會彈出一個對話框,告訴您已選擇了多少個單元格,請單擊 OK 按鈕。

4.現在,如果列D中存在值,則選擇列A中的值。您可以按 刪除 鍵以手動刪除它們。

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


使用Kutools for 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 (16)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
"foruma contains an error!"
Wondeful help...
This comment was minimized by the moderator on the site
the function is correct: maybe you have Excel in a different language than english. Change the function names in that way. :)
This comment was minimized by the moderator on the site
Thank you for this. It solved my problem of wanting to include only companies from a list
This comment was minimized by the moderator on the site
This formula subtracts list in column B from list in columnA:=FILTER(IFNA(MATCH(A2:A12,B2:B6,0),A2:A12),ISNUMBER(IFNA(MATCH(A2:A12,B2:B6,0),A2:A12))=FALSE)
This comment was minimized by the moderator on the site
But this one's simpler (Subtracts list in A2:A20 from list in D2:D6):=FILTER(A2:A20,ISERROR(MATCH(A2:A20,D2:D6,0))=TRUE)
This comment was minimized by the moderator on the site
Keith,

This formula was incredibly helpful (even more helpful than the actual blog post!) You're a life saver! This formula gets really powerful if you use it in dynamic arrays.
This comment was minimized by the moderator on the site
what if I have multiple columns?
This comment was minimized by the moderator on the site
Depends on the structure of your lists, but if you want to exclude several lists Y and Z from a single big list X, try something like this:
=FILTER(X3:X21,ISERROR(MATCH(X3:X21,Y3:Y6,0))*ISERROR(MATCH(X3:X21,Z3:Z5,0))=1)
this returns listX minus listY and listZ.
The "ISERROR(MATCH(X3:X21,Y3:Y6,0))" returns "TRUE" if an item in listX is missing from listY, likewise ISERROR(MATCH(X3:X21,Z3:Z5,0)) for listX and listZ.
A quirk of Excel is that "=TRUE*TRUE" will return "1". In fact, any number of TRUEs multiplied will return "1", but include a single FALSE and it will return "0".
So the FILTER will return only those items from the list where all the "ISERROR(MATCH....." formulae are TRUE.
For each additional list of items to exclude, add an extra *ISERROR(MATCH(listX,list_exclude,0)) before the "=1)"
This comment was minimized by the moderator on the site
You could try a filter of a filter:=FILTER(A2:A20,ISERROR(MATCH(A2:A20,FILTER(Array2,Include_criteria2)))=TRUE)
This comment was minimized by the moderator on the site
Apologies, that should read "Subtracts list in D2:D6 from list in A2:A20."
This comment was minimized by the moderator on the site
Apologies, that should read "Subtracts list in D2:D6 from list in A2:A20."
This comment was minimized by the moderator on the site
Apologies, that should read "Subtracts list in D2:D6 from list in A2:A20"
This comment was minimized by the moderator on the site
Good find. Thank you for this clever workaround. I thought was only possible via macros.
Possible to do the same using method 1, for a range consisting in two columns. i.e City, State in col D2:E20 while my A2:C1000 (B:C has city,state) has the set I need to get marked?
tried this did not work: =COUNTIF($D$2:$E$20,B2:C2). Unless you have another wonderful guide.
This comment was minimized by the moderator on the site
Как безграмотный человек писал эту статью? Тот, кто русский язык не учил, ни одной книги не прочел и не общался в социуме никогда? Уже с самого начала статьи обороты почти в каждом предложении такие, что на голову не натянешь. Зачем писать, если не умеешь писать?
This comment was minimized by the moderator on the site
I receive other values in the COUNTIF column like 2 but also higher numbers other than 0 and 1. What does that mean?
This comment was minimized by the moderator on the site
The values you get in the COUNTIF column are equal to the number of occurrences of the element in the right column. For example, if you have 5 displayed against a cell in the Name column, it means that this name was found in the To-remove-list not one, but five times.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations