+ Reply to Thread
Results 1 to 5 of 5

Is there any limitation for if function ?

  1. #1
    Registered User
    Join Date
    11-11-2008
    Location
    singapore
    Posts
    11

    Is there any limitation for if function ?

    Hi all,

    Can anyone enlighten me on the following issue.

    I've a long list of value with indicator which I need to compare with an entry after which it need to return a text indicator. I'm using IF and MATCH function.

    Following is the code I use:

    =(IF(MATCH(C1,$D$5:$D$29,0)<=5,$E$9,IF(MATCH(C1,$D$5:$D$29,0)<=10,$E$14,IF(MATCH(C1,$D$5:$D$29,0)<=15,$E$19,IF(MATCH(C1,$D$5:$D$29,0)<=20,$E$24,IF(MATCH(C1,$D$5:$D$29,0)<=25,"Not Found"))))))

    I've attached an excel file with an sample.

    Btw, Is there anyway I can omit the length of IF & MATCH function by using other function.

    Pls advice. Thanks
    Marc
    Attached Files Attached Files
    Last edited by VBA Noob; 11-12-2008 at 02:51 AM. Reason: Marked as solved

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    One way:

    Please Login or Register  to view this content.
    which must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear around the formula
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    The issue wasn't with the IF functions (in Excel 2003 you can have a max of 7 nested IF's, by the way). The error was coming with your MATCH function. Any number in C1 greater than 25 was generating an error in the first IF condition, and causing the entire formula to error.

    One non-array version (no need for CTRL+SHIFT+ENTER) that should fix this is:

    =IF(ISNA(MATCH(C1,D5:D29,0)),"Not Found",LOOKUP(MATCH(C1,D5:D29,0),{1,6,11,16,21},{"Test 1","Test 2","Test 3","Test 4","Test 5"}))

    NBVC, yours still seems to error if the user enters 26 (or any number greater than 25).

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by pjoaquin View Post
    ...


    NBVC, yours still seems to error if the user enters 26 (or any number greater than 25).
    Easily remedied with an error trap:

    Please Login or Register  to view this content.
    CSE confirmed once again

  5. #5
    Registered User
    Join Date
    11-11-2008
    Location
    singapore
    Posts
    11
    Thanks all for the great help.

    Marc

+ 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