Say you want to divide the value in A1 by the value in A2. That formula is simple:
The problem is that if the value in A2 is zero, it doesn't work, thus the error you're seeing, so
check that cell first. There are couple of ways to do that.
Code:
=IF(ISERROR(A1/A2),0,A1/A2)
or
=IF(A2=0,0,A1/A2)