Ishtiak Ahmed
Ishtiak Ahmed

Reputation: 21

ISERROR with multiple if condition

I want to put Y if cell A1 is negative OR an error. I want to put N otherwise. But this formula is not working:

if(OR(ISERROR(A1),A1<0),"Y","N")

Is there any other way to do it?

Upvotes: 2

Views: 6676

Answers (2)

user4039065
user4039065

Reputation:

The newer¹ IFERROR function can shorten your multiple boolean criteria by providing a default response when an error is encountered.

=IF(IFERROR(A1<0, TRUE), "Y", "N")

Attempting to resolve A1<0 when A1 is any error (e.g. #DIV/0!, #N/A, etc) will result in an error and TRUE will be returned to the IF. When A1 is not an error, A1<0 is resolved to a boolean result.

a1lessthanerror


¹ The IFERROR function was introduced with Excel 2007. It is not available in earlier versions.

Upvotes: 1

Fratyx
Fratyx

Reputation: 5797

Excel evaluates both parts of an OR expression independent if the first part is true. So A1<0 and therefore the OR function result in an error if A1 contains an error.

You can try something like that:

IF(ISERROR(A1),"Y",IF(A1<0,"Y","N"))

Upvotes: 1

Related Questions