Iserror formula

Steve=True

Well-known Member
Joined
May 27, 2011
Messages
993
Hi All,

I normally write formulas that could error out or be #NA like this:

=if(iserror(really really long formula),"",really really long formula)

I don't like repeating the function as an error checker and then a result.

Is there another way to do this?

Thanks

Steve=True
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi All,

I normally write formulas that could error out or be #NA like this:

=if(iserror(really really long formula),"",really really long formula)

I don't like repeating the function as an error checker and then a result.

Is there another way to do this?

Thanks

Steve=True
If you're using Excel 2007 or later the easiest (but maybe not the best) way is to use the IFERROR function:

=IFERROR(your_formula_here,"")

There are other ways that depend on the type of data the formula returns and what result you want to replace any errors.

If you can post the real formula(s) we can be more specific (maybe!). Sometimes you can trap errors without even using any of the error checking functions.
 
Upvote 0
Thanks T., you are right, i forget about iferror. i will review more about if error, but i generally try to build the spreadsheets to 2003 specs.

Here is my if error statement. The reason that it is #na is that the user has picked a start date that is in the future so no data will display, but instead of #na, i want to display blank ""

Here is my formula before iserror:
=IF(AND(COLUMN()<StatusMonthHighlight,SUMPRODUCT(1*(V6:V25=CHAR(NotStarted))+1*(V6:V25=CHAR(Started))+1*(V6:V25=CHAR(Completed)))>0),IF(SUMPRODUCT(--((V6:V25=CHAR(NotStarted))))>0,IF(StatusMonthHighlight-COLUMN()>1,-1,0),IF(SUMPRODUCT(--((V6:V25=CHAR(Started))))>0,IF(StatusMonthHighlight-COLUMN()>2,-1,0),1)),"")

and after is error:

=IF(ISERROR(IF(AND(COLUMN()<StatusMonthHighlight,SUMPRODUCT(1*(V6:V25=CHAR(NotStarted))+1*(V6:V25=CHAR(Started))+1*(V6:V25=CHAR(Completed)))>0),IF(SUMPRODUCT(--((V6:V25=CHAR(NotStarted))))>0,IF(StatusMonthHighlight-COLUMN()>1,-1,0),IF(SUMPRODUCT(--((V6:V25=CHAR(Started))))>0,IF(StatusMonthHighlight-COLUMN()>2,-1,0),1)),"")),"",IF(AND(COLUMN()<StatusMonthHighlight,SUMPRODUCT(1*(V6:V25=CHAR(NotStarted))+1*(V6:V25=CHAR(Started))+1*(V6:V25=CHAR(Completed)))>0),IF(SUMPRODUCT(--((V6:V25=CHAR(NotStarted))))>0,IF(StatusMonthHighlight-COLUMN()>1,-1,0),IF(SUMPRODUCT(--((V6:V25=CHAR(Started))))>0,IF(StatusMonthHighlight-COLUMN()>2,-1,0),1)),""))
 
Upvote 0
Thinking outside the box...

Instead of testing the whole formula for error...
Test for what causes the error...

The reason that it is #na is that the user has picked a start date that is in the future

so test for that..

=IF(StartDate>TODAY(),"",really long formula here)
 
Upvote 0
Thank again.

Here is the revised formula where i incorporated a check to see if the status month was an error vs the entire formula.

=IF(ISERROR(StatusMonthHighlight),"",IF(AND(COLUMN()<StatusMonthHighlight,SUMPRODUCT(1*(W6:W25=CHAR(NotStarted))+1*(W6:W25=CHAR(Started))+1*(W6:W25=CHAR(Completed)))>0),IF(SUMPRODUCT(--((W6:W25=CHAR(NotStarted))))>0,IF(StatusMonthHighlight-COLUMN()>1,-1,0),IF(SUMPRODUCT(--((W6:W25=CHAR(Started))))>0,IF(StatusMonthHighlight-COLUMN()>2,-1,0),1)),""))

Great suggestions!
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top