Log in

View Full Version : Replace #DIV/0! With other values


Wonder84lalala
May 9, 2008, 01:21 PM
Is it possible to replace the output from #DIV/0! To 0 or other random values within a cell?

I tried using if statement, but it won't let me:

=IF(A1=#DIV/0! 0)

Thanks for your help.

JBeaucaire
May 9, 2008, 02:42 PM
Say you want to divide the value in A1 by the value in A2. That formula is simple:

=a1/a2

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.

=IF(ISERROR(A1/A2),0,A1/A2)
or
=IF(A2=0,0,A1/A2)