Delete duplicate items in excel

Closed
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,
I need to write a macro where it deletes duplicates but the marcos out there seem to delete all duplicates I just want it to delete a cell if the previouse cell is the same
example

cat
dog
cat
cat
dog
mouse
mouse

would end up being

cat
dog
cat
dog
mouse



1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
803
suppose data is from A1 to aA7

in some empty cell below e.g. A15 copy this formula

=IF(COUNTIF(A1:$A$7,A1)>1,"",A1)
copy A15 down till you get 0


you can delete blank rows in rows 15 down.

another method is use advance filter
read excel help for this