简体   繁体   中英

Find and delete multiple values in excel

I have a list of 10,000 ID numbers in excel, and another excel file containing 500 ID numbers that I need to delete from the first list. Is there an easy way to find and delete them all?

Flag Cells You Want to Delete

One simple way to do this is to flag the cells you want to delete from the ID column, then sort that column so that the delete values are all together. Once sorted, simply delete all ID values labeled "Delete".

Let's assume your big ID list (from which you'll delete IDs that are no longer needed) is found in a workbook called IDMAIN.xlsx , in Column A of a sheet labeled main . The ID list has a header, so the list of ID values begins on cell A2 .

Let's also assume your delete list is in an Excel workbook called IDDELETE.xlsx , and the list is in Column A of the delete sheet. This list also contains a header, so the list of IDs you want to delete also begins on cell A2 and ends on cell A501 .

  • In cell B2 (right underneath a column header labeled "Keep or Delete") on the main sheet in the IDMAIN.xlsx file, insert the following formula:
    =IF(ISERROR(VLOOKUP($A2,[IDDELETE.xlsx]delete!$A$2:$A$501,1,FALSE)),"Keep","Delete")

  • Copy this formula down to the end of your ID list.

  • Highlight columns A:B and sort by the "Keep or Delete" column, in "Z to A" order.

  • Your IDs flagged "Delete" will appear in the last 500 cells of your main ID list, ready to be deleted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM