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:
The fact that the cell contains a formula already means that it is not truly empty. Common practice is to use an empty string, like
=IF(A1=A2, B2,"")
There are not many situations where this will be problematic, and if a problem arises, in most cases there are different techniques that can be applied.