+ Reply to Thread
Results 1 to 6 of 6

Streamlining nested IF/ ISNA

  1. #1
    Registered User
    Join Date
    02-04-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Streamlining nested IF/ ISNA

    Hi there I have a formula which returns #NA in several cells, is there a way to replace this with a zero without nesting an IF and ISNA and repeating the formula? It just feels a bit clunky... if anyone can streamline it I would be grateful.
    My formula is:
    =INDEX(INDIRECT("'"&A4&"'!$CW$112:$EA$163"),MATCH(B4,INDIRECT("'"&A4&"'!$b$112:$b$163"),0),MATCH($T$2,INDIRECT("'"&A4&"'!$Cw$7:$ea$7"),0))

    and so to add the IF and ISNA it becomes:
    =IF(ISNA(INDEX(INDIRECT("'"&A4&"'!$CW$112:$EA$163"),MATCH(B4,INDIRECT("'"&A4&"'!$b$112:$b$163"),0),MATCH($T$2,INDIRECT("'"&A4&"'!$Cw$7:$ea$7"),0))),0,INDEX(INDIRECT("'"&A4&"'!$CW$112:$EA$163"),MATCH(B4,INDIRECT("'"&A4&"'!$b$112:$b$163"),0),MATCH($T$2,INDIRECT("'"&A4&"'!$Cw$7:$ea$7"),0)))

    which as you can see is a bit of a mouthful!!
    Thanks
    Last edited by boatbabe; 08-25-2011 at 09:39 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Streamlining nested IF/ ISNA

    If you're using Excel 2007 or later you can use the IFERROR function:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-04-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Streamlining nested IF/ ISNA

    Thanks. Will this zero #REFs as well though? As these would be useful to spot.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Streamlining nested IF/ ISNA

    It will, unfortunately, but at the moment there's no IFNA function, so you either return one value for all errors or you have to work with the long-winded formula.

    Edited to add: Or you could write an IFNA UDF, I suppose. Sooner you than me

  5. #5
    Registered User
    Join Date
    02-04-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Streamlining nested IF/ ISNA

    I think it will take me less time to go with the long winded way - thanks!

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Streamlining nested IF/ ISNA

    Looking at your formula the only way you could get a REF error is if the sheet named in cell A4 doesn't exist, so you could change your formula to:

    Please Login or Register  to view this content.
    The first COUNTA is just a random operation on the named sheet to see if it exist - if it doesn't you'll get a REF error, because that operation is outside the IFERROR statement.

    Mind you, I'm not sure it's any quicker than the long-winded formula

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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