AnchovyLegend
AnchovyLegend

Reputation: 12538

Excel: Checking for errors in an IF statement

I am trying to write an excel if statement. I am new to using all the extra functionality Excel has. I am using a function called importXML(). I am trying to check whether a function I am using generates a "#VALUE!" error as follows:

if(
   importXML(B1,C1)!="#VALUE!" //check if no error generated, 
   importXML(B1,C1)//if no error is generated, use these cells in the function
   importXML(A1,C1)//else use these cells in the function
)

Is this possible? Am I using excels if statement correctly to check for errors?

Upvotes: 2

Views: 1654

Answers (1)

nullrevolution
nullrevolution

Reputation: 4137

Try this:

=IF(ISERROR(importXML(B1,C1)),value_if_true,value_if_false)

ISERROR Function

Upvotes: 2

Related Questions