Other questions have touched on this and offered solutions that are not viable for a very large data set. I have a formula like the following across 9 columns:
try this
=IF(A1=A2,B2,TRIM(""))