In Excel sheet, if we want to display custom error when we apply formula into cells. IFERROR function returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula. Use the IFERROR function to trap and handle errors in a formula.
Syntax:
IFERROR(value,value_if_error)
Note:
· Value is the argument that is checked for an error.
· Value_if_error is the value to return if the formula evaluates to an error. The following error types are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.
· If value or value_if_error is an empty cell, IFERROR treats it as an empty string value ("").
· If value is an array formula, IFERROR returns an array of results for each cell in the range specified in value. See the second example below.
Example:
From the above image, I’m going to calculate per unit cost, if value is calculated successfully then it return value otherwise it return error message. See below example.
=IFERROR(B3/C3,”Error in calculation”)
Note:
When we apply formula on row 3-9 for calculating per unit cost, all return value but row 8 return custom error message because value not divided by 0 (zero).
Leave Comment