For the logical test use ISBLANK and C6 for the reference. For [value_if_true], use empty double quotes, and for [value_if_false], use the original formula: D6/C6.
When I copy this formula down, we get the correct result for the first 3 sections and nothing is displayed for the last two sections.
This is a flexible way to trap errors since you are checking the source cells for any condition that you like. You can easily test for empty values, positive values, or values that match any condition that makes sense.
Another way to trap this error is to use the IFERROR function which was introduced with Excel 2007.
IFERROR takes two arguments, value and value_if_error. For value, we supply the original formula, and for value_if_error, use empty double-quotes.
IF value is an error—that is if our formula returns an error—IFERROR will catch it and return the empty string. If there's no error, IFERROR will simply display the value; in this case, the result of the formula.
If you're using an older version of Excel you can also test for an error using the IF function and the ISERROR function, which will return TRUE with any error.
In this case, the logical test is the ISERROR with the original formula. The value if true is empty double quotes, and the value if false is the original formula.
This works fine, but the structure is redundant and more error-prone compared to IFERROR, so you're better off using IFERROR when possible.
Finally, although we're using empty double quotes to display nothing when we detect an error condition, you could also display any message that you like. For example, you could display "not enough data" instead of an empty cell, or any other message that makes sense for the error that you're trapping.
The IF function runs a logical test and returns one value for a TRUE result, and another for a FALSE result. For example, to "pass" scores above 70: =IF(A1>70,"Pass","Fail"). More than one condition can be tested by nesting IF functions. The IF...
The Excel IFERROR function returns a custom result when a formula generates an error, and a standard result when no error is detected. IFERROR is an elegant way to trap and manage errors without using more complicated nested IF statements.
The Excel ISERROR function returns TRUE for any error type excel generates, including #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL! You can use ISERROR together with the IF function to test for errors and display a custom message, or...