Why does FIND evaluate to #VALUE! when it doesn't find the value?

Viewed 44

I'm using this Excel formula:

=IF(FIND("Door", D2, 1),F2, 0)

However, it evaluates to #VALUE! when the value is not found. In that case, I want the formula to evaluate to 0.

What am I doing wrong?

1 Answers

Use ISNUMBER().

Find returns the relative position of the text if found, and a #VALUE! error (not FALSE) if not.

If the condition returns an error, then the IF will return that error.

So, use this instead:

=IF(ISNUMBER(FIND("Door", D2, 1)),F2, 0)
Related