To avoid errors being displayed, combine the IF formula with the ISERROR formula:
1. In cell A1, type the number 100.
2. In cell B1, type the formula =A1/A2. The calculation returns an error #DIV/0!, which occurs when trying to divide a number in a cell by 0 (A2).
3. To avoid displaying this error in a cell, in cell C1, enter the formula =ISERROR(B1). The formula returns the result TRUE. That is, cell B1 contains an error in the calculation of the formula (the ISERROR formula is located in the Information category in the Paste Function dialog box).
4. In cell D1, enter an IF formula =IF(C1,0,B1).
5. Combine the formulas into one nested formula by copying the formula (without the = sign) from cell C1, and pasting it into cell D1 (see tip # 196).
6. From cell B1, copy the formula (without the = sign), and paste it twice.
The result is one nested formula: =IF(ISERROR(A1/A2),0,A1/A2).
This is how we use iserror in excel to avoid error messages.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.