Share via

Excel 2016 Iferror

Anonymous
2016-02-11T18:20:00+00:00

Part of a spreadsheet has

   Date due   Date done    Difference

Since the date done may be blank, I want to use Iferror to just display "0" or similar. I enter e.g. =IFERROR(E10-F10,"0")

This works the first time but if I enter a done date, then remove it, the error message is replaced by a 5 digit number e.g. 43678 which changes depending on source data which is not even in the formula.

What is going on? Any ideas?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-02-11T19:22:27+00:00

MaxinUK wrote:

Part of a spreadsheet has

   Date due   Date done    Difference

Since the date done may be blank, I want to use Iferror to just display "0" or similar. I enter e.g. =IFERROR(E10-F10,"0")[.] This works the first time but if I enter a done date, then remove it, the error message is replaced by a 5 digit number e.g. 43678 which changes depending on source data which is not even in the formula. What is going on? Any ideas?

First, do you want the string "0" (!), or do you really want the number zero?  I suspect the latter.  So write:

=IFERROR(E10-F10, 0)

Second, that will not trigger an error condition if E10 or F10 is truly empty:  no constant and no formula.  That is, they do not simpy appear blank because their value is the null string ("").

IFERROR returns the error result (second parameter) only when there is an Excel error:  things like #VALUE, #DIV/0, etc.

So 43678 that you see is probably the numeric value of the date in E10 because F10 is truly empty (behaves like zero in this context).

Since you normally do not expect E10-F10 to be a date, do not format the cell as date.

Instead, change the formula to recognize the conditions correctly.  Perhaps:

=IF(OR(E10="",F10=""), 0, E10-F10)

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-02-11T20:20:03+00:00

    Actually, your second suggestion seems to fix the problem. Many thanks.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-02-11T20:15:01+00:00

    Thanks. I later realised that is was the date causing most of the problem. But I am handling dates i.e. I put in a due date and later an actual date and I want the days difference + - or 0 to display (for later calculation). While the actual date is missing (or if I change it), I want the output box to be blank not displaying #Value etc.

    Was this answer helpful?

    0 comments No comments
  3. Vijay A. Verma 104.9K Reputation points Volunteer Moderator
    2016-02-11T19:10:21+00:00

    What you are getting is a date. Format your result field as date, you will understand.

    Was this answer helpful?

    0 comments No comments