Menjebak dan menangani kesalahan
=IFERROR(value, value_if_error)
| Parameter | Deskripsi |
|---|---|
value |
The value, reference, or formula to check for an error. |
value_if_error |
The value to return if an error is found. |
The IFERROR function returns a custom result when a formula returns an error and a normal result when a formula calculates without an error. The typic
=IFERROR(formula,custom)
In the example shown, the formula in E5 copied down is:
=IFERROR(C5/D5,0)
This formula catches the #DIV/0! error that occurs when the quantity field is empty or zero, and replaces it with zero. You are free to change the zer
=IFERROR(C5/D5,"")
Sometimes you may want to suppress a calculation until the worksheet receives specific input. For example, if A1 contains 10, B1 is blank, and C1 cont
=IFERROR(A1/B1) // returns #DIV! if B1 is empty
The formula below has been modified to use the IFERROR function to trap the #DIV/0! error and remap it to the message "Please enter a value in B1".
=IFERROR(A1/B1,"Please enter a value in B1")
A common problem in Excel is that errors in data will corrupt the results of other formulas. For example, in the worksheet shown below, the goal is to
=SUM(D5:D15) // returns #N/A