+ Reply to Thread
Results 1 to 5 of 5

Where do I insert ISERROR?

  1. #1
    Registered User
    Join Date
    12-17-2008
    Location
    Seattle, WA
    Posts
    39

    Where do I insert ISERROR?

    Hi everyone,

    I am using an array formula like this in cells A2:H100 of a worksheet:

    =INDEX('Source Data'!$A$2:$Q$5000,SMALL(IF(('Source Data'!$I$2:$I$5000>=$O$1)*('Source Data'!$I$2:$I$5000<=$P$1)*('Source Data'!$M$2:$M$5000>0),ROW('Source Data'!$A$2:$Q$5000)-ROW('Source Data'!$A$2)+1,ROW($Q$5000)+1),ROW()-1),1)

    The function must be present in all 99 rows to accommodate potential data, but there is rarely enough data to populate the entire sheet, leaving #REF! errors in some cells.

    Putting aside that using this many array formulae is sloppy programming, how do I craft the function above to return no value if the function evaluates to an #REF! error?

    Thanks and best regards,
    Anthony
    Last edited by ACurtis802; 02-26-2009 at 03:06 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Where do I insert ISERROR?

    If you use ISERROR, you double the processing load of the formula. The general form is

    =if(iserror(bigLongExpression), "", bigLongExpression)

    Suggest you instead use conditional formatting with ISERROR to make the font the same color as the cell when the formula returns an error, so it's not apparent.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Where do I insert ISERROR?

    Rather than evaluate every formula twice with an IF(ISERROR() approach, let's use the Excel 2007 approach of IFERROR.

    Change your existing formula to:

    =IFERROR(INDEX('Source Data'!$A$2:$Q$5000,SMALL(IF(('Source Data'!$I$2:$I$5000>=$O$1)*('Source Data'!$I$2:$I$5000<=$P$1)*('Source Data'!$M$2:$M$5000>0),ROW('Source Data'!$A$2:$Q$5000)-ROW('Source Data'!$A$2)+1,ROW($Q$5000)+1),ROW()-1),1),"")

    If you're NOT using Excel 2007, we can still use this, but you have to add the IFERROR function to your sheet. Here's the code:
    Please Login or Register  to view this content.
    To add it to your sheet, press Alt-F11
    Click Insert>Module
    Paste in the code above
    Alt-F11 to close the editor
    Save your sheet

    Now the =IFERROR(FormulaToUse,DoThisIfErrorOccurs) format will work.
    Last edited by JBeaucaire; 02-25-2009 at 09:52 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    12-17-2008
    Location
    Seattle, WA
    Posts
    39

    Re: Where do I insert ISERROR?

    Thank you, shg and JBeaucaire. This gives me two workable options.

    Best regards,
    ACurtis802

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Where do I insert ISERROR?

    You're welcome.

    To be clear, the conditional formatting formula you need is just =iserror(me), where me is the address if the cell in which it appears. You don't need to reevaluate the big expression.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1