+ Reply to Thread
Results 1 to 5 of 5

Thread: Index/Lookup formula

  1. #1
    Registered User
    Join Date
    11-13-2008
    Location
    england
    Posts
    3

    Index/Lookup formula

    Hi there,

    Struggling with a lookup formula that wizard produced....

    =INDEX($AS$9:$AT$33, MATCH(B4,$AS$9:$AS$33,), MATCH("PERCENTAGE",$AS$9:$AT$9,))

    That's all fine but some of the items in the list will not be able to match the lookup table and in this case I want it to say 0 (zero), but instead its saying #N/A which I understand means data unavailable. Is there a way of saying if so and so doesn't match put 0 instead of #N/A?

    Thanks!!!!!!
    Last edited by VBA Noob; 11-13-2008 at 08:52 AM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228
    Wrap that whole formula in an IF(ISERROR) trap.
    =IF(ISERROR(INDEX($AS$9:$AT$33,MATCH(B4,$AS$9:$AS$33,),MATCH("PERCENTAGE",$AS$9:$AT$9,))),0,INDEX($AS$9:$AT$33,MATCH(B4,$AS$9:$AS$33,),MATCH("PERCENTAGE",$AS$9:$AT$9,)))
    Last edited by JBeaucaire; 11-13-2008 at 07:26 AM. Reason: Changed blank result to "0" as requested by OP
    _________________
    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!)

  3. #3
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228
    If you know the cells that's empty and causing the problem, you could just check that cell first to make the trap shorter. You decide. If you can test a shorter range, test that instead. For instance maybe that cell B4 is empty...

    =IF(ISBLANK(B4),0,INDEX($AS$9:$AT$33,MATCH(B4,$AS$9:$AS$33,),MATCH("PERCENTAGE",$AS$9:$AT$9,)))
    _________________
    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
    11-13-2008
    Location
    england
    Posts
    3
    Thank you, I'll give them both a go and get back to you if I need more help!

  5. #5
    Registered User
    Join Date
    11-13-2008
    Location
    england
    Posts
    3
    It worked!!! Thanks!!!

+ 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.2.0