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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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