Google-sheets – Getting div/0 error Google Sheets

google sheets

I have a Google Sheets which basically looks like this:

Enter a number: cell1here

Enter another number: cell2here

Cell2 number converted to correct units: cell3here (cell2 * cell 8)

total: cell4here (cell2 divided by cell1)

So basically the user just needs to enter a number in cell1 and cell2, and other numbers will show up in cell3 and cell 4.

But when I keep cell1 and cell2 blank, I get an error in cell4, saying #DIV/0. But, when cell1 and cell2 are blank I just want cell4 to show 0.00 instead. Is this possible, if so how can I do this?

Best Answer

It seems like you need an IF statement, e.g. something like this:

=IF(B2=0,"",A2/B2)

enter image description here

Even though the content of B2 isn't 0, its numerical value is. If you want it to show 0.00 instead of a blank cell, use

=IF(B2=0,0,A2/B2)

and adjust the formatting if necessary.