How do I choose which row to keep in Remove Duplicates?

New Contributor



I have several thousand rows that have data in the URL column in common.


I want to Remove Duplicates using data in this column to signify which row is a duplicate.


But data elsewhere in each row may be different.


While I want to remove duplicates based on that URL data, I also want to choose which rows to keep based on the contents of another cell.


  • Say two rows have the same URL -
  • In the Paragraphs column, one row has 0, and the other has any other number.

How can I remove only the duplicate row that has 0 in the Paragraphs column?


Thank you!

2 Replies





This is can be done by using a formula in a helper column to identify the columns that you need to delete.


I suggest this formula:

=IF(COUNTIF($B$2:$B$10,B2)>1,IF(A2=0,"To be removed",""),"")

Delete specific columns.png


After that, you can sort the helper column from A to Z, then select the marked columns and delete them.

Delete specific columns2.png



Hope that helps

It's impossible that this answer can be bettered.

Thank you so much for taking the time to answer. It's greatly appreciated.
Related Conversations
A problem with the Zoom level of a Tab
Tavory in Discussions on
9 Replies
How do I group rows in an excel table?
Marisa Medrano in Excel on
1 Replies