Testing for Errors using ISERROR Function in Excel

The ISERROR Function in Excel allows to test for error messages that may result from a formula. The error messages covered include; #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL! .

This function is actually part of the IS Functions in Excel that check the type of value and returns TRUE or FALSE depending on the outcome.

excel-iserror-functionTo locate errors in our formulas we will need to combine the ISERROR Function with the IF Function. TO generate an error message I will divide 30 by 0. So in cell C2 type 30 and cell D2 type 0. Then in cell B2 type the following formula:

=C2/D2

You will see that you get a result of #DIV/0! . So, now let’s error test the formula first to stop the error message being generated. So in cell C3 type 30 and D3 type 0. Then in cell B3 type the following formula:

=IF(ISERROR(C3/D3),"This is an error",C3/D3)

You will see you now get a result of “This is an error”. Let’s breakdown the formula.

excel-iserror-function-1

IF(ISERROR(C3/D3),"This is an error" – This section of the formula is essentially saying if C3(30) divided by D3(0) is an error then display “This is an error”. You could even just put “” and then the result would be a blank cell rather than the message.

,C3/D3) – This part of the code is only carried out if there is no error. So putting the formula back together with description underneath:
=IF(ISERROR(C3/D3),"This is an error",C3/D3)
=IF(logical_test),value_if_true,value_if_false)

I hope you found this post useful?

Leave a Reply

Your email address will not be published. Required fields are marked *