Delete duplicate items in excel

Closed
bamster - May 17, 2011 at 12:38 PM
venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - May 17, 2011 at 09:52 PM
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

venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 810
May 17, 2011 at 09:52 PM
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
0