Home » excel » Deleting entire row based on first 2 cell values in Excel

Deleting entire row based on first 2 cell values in Excel

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have an excel sheet with 2000 rows and 3 columns. I am looking for a solution for “deleting entire row if cell 1 and cell 2 of every row are equal. In other words,

Cell1  Cell2 Cell3 
ID1    id1   val1   -delete
ID4    id1   val1   -retain
ID2    id2   val1   -delete
ID2    id1   val1   -retain

I saw a lot of answer in VBA, but I am looking for an excel solution.Thanks.

How to&Answers:

I saw a lot of answer in VBA, but I am looking for an excel solution.

I’m not sure what do you exactly mean by “excel solution”, but you can add 4th column with formula:

=a2=b2

Fill the entire column with it.

Add autofilter, select TRUE in 4th column and delete all rows.

Alternatively (if you do not want the extra column), you can use conditional formatting with the same formula, set background of the cells to some unused color, and then again use autofilter to find cells with this background color.